Friday 28 December 2012

To deploy the Web Part by using Windows PowerShell


1- On the Start menu, click All Programs.

2 - Click Microsoft SharePoint 2010 Products.

3 - Click SharePoint 2010 Management Shell.

4 - At the Windows PowerShell command prompt (PS C:\>), type the following command, and then press ENTER:

      Install-SPWebPartPack -LiteralPath "<PathToCabFile>" -Name "<WebPartName>"

Where:
   <PathToCabFile> is the full path to the CAB file that is being deployed.
   <WebPartName> is the name of the Web Part that is being deployed.

Wednesday 26 December 2012

Adding a Script Reference Dynamically Through Code


protected override void OnPreRender(EventArgs e)
{
     // Register the jQuery script from "_layouts/jQuery/jquery-1.6.js"
     ScriptLink.Register(this.Page, "jQuery/jquery-1.8.3.js", false);
     base.OnPreRender(e);
}

Friday 21 December 2012

Sharepoint designer workflow does not start automatically

I create a work flow in sharepoint designer and publish it. I enable Automatically start this workflow when a new item is created.But when i create new item this workflow does not start automatic.

Solution:
SPD workflow will not start automatically under System Account.

If you have installed the Infrastructure update, you can change the account that associated the workflow via stsadm which will allow it to automatically start.

Or Log in to a different account and do the same operation in list. Work flow will be running fine.

Thursday 20 December 2012

Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.


I am getting the above error, when I am  trying to deploy the web part through visual studio. The reason is the current logged-in user may not be the "db owner" in the content databases.

Solution:
To deploy the solution successfully, you need to map the current logged-in user as db_owner into the 3 databases.
1. SharePoint_Config
2. SharePoint_Admin_[GUID]
3. Your current web application that needs to deploy the Web part
To do the above open sql server.
Go to security -> Logins. Choose the user name.
Right click on it  -> Go to properties  -> click on User Mapping .

See the below image for details.


Sunday 16 December 2012

How to Remove a User from a SharePoint 2010 Site Collection


1 - As a site collection administrator, click Site Actions –> Site Permissions.
2 - Click into any existing group (like site Owners).  The URL will be something like http://server/_layouts/people.aspx?MembershipGroupID=28.
3 - Change the 28 to a 0.  The list should now show you All People.
4 - Find the user who isn’t updating, click the checkbox by their name.
5 - Click Actions, Delete Users from Site Collection.

What happens behind the scene when we create new Web Application in SharePoint ?


When we create a new Web Application in SharePoint, following are various actions which happens behind the scene:

1 - Creates a unique entry in SharePoint configuration DB for the Web Application and assign GUID to
that entry.
2 - Create and configures a new site in IIS
3 - Creates and configures a new IIS application pool.
4 - Configures authentication protocol and encryption settings.
5 - Assign a Default alternate access mapping for the Web Application.
6 - Creates the first content database for the Web Application.
7 - Associate a search service with the Web application.
8 - Assign a name to the Web application that appears in the Web application list in SharePoint Central Administration.
9 - Assign general settings to the Web application, such as maximum file upload size and default time zone.
10 - Updates the web.config file to make entries for custom HTTP Modules and Handlers for SharePoint.
11 - Creates virtual directories for SharePoint web services and SharePoint layouts folder.

After creating a Web Application in SharePoint, the web site is actually not created yet. It means if you try to access the Web Application using the web app url, it will show you "Page cannot be displayed" error. Basically at this point of time, a web application has been created and all the mandatory configuration has been done. Now the next step is to create a Site Collection using a particular Site Definition, then only the actual site will be created and you will be able to access the site using the url of Site Collection.

Wednesday 12 December 2012

To remove the title column from a Sharepoint list


If you want to remove the "title" column permanently, follow the steps given below:

1. Go to the Settings->List Settings->Advanced settings.

2. Check the "yes" Radio button for "Allow management of Content types" and hit OK.

3. Setp 2 will give you "Content types" option on the settings page which will have "Item" content type.

4. Click on "Item" .

5. Clicking on the "Title" will give the screen where you can hide the column completely for future use. Click on "Hidden" under "Column settings" option in this page and hit Ok.

6. Now go back to the list and add a new item and you won't see the "Title" column.

Filter Lookup Field Values by Current User in caml query


If you want to pass current logged user into caml query, you can use this one :

<Where>
  <Eq>
    <FieldRef Name="Author" />
    <Value Type="Integer">
      <UserID />
    </Value>
  </Eq>
</Where>

Friday 7 December 2012

Completely Remove a Feature from Site Collection

After you deploy a feature from Visual Studio to Sharepoint 2010, you can see the feature in Site Actions  -->  Site Settings --> Site Collection Features, from there you can activate or deactivate the feature.

Click on start --> Microsoft Sharepoint 2010 products --> Sharepoint 2010 Management Shell.

To Complete remove the chnage password option Type
Uninstall-SPFeature ChangePassword

Note: Each feature is available is in its own subdirectory in the path:
%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES\

You need to use the actual subdirectory name (not the name shown in the Site Collection Features screen) in order to uninstall it. You need to deactivate the feature before removing it.

Friday 30 November 2012

How to connect FBA site


ClientContext clientContext = new ClientContext("http://YourUrlHere");
clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
clientContext.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo("username", "password");

Monday 26 November 2012

Changing URL of Sharepoint 2010 List

1 - Open Sharepoint 2010 site in Sharepoint Designer 2010.
2 - Click on All Files view.
3 - From the report click on Lists and from the left pane expand lists and then select the list for which the URL has to be changed.
4 - Then right click on the list name and from the context menu click Rename.
5 -If the name is changed here then the URL of the list is also changed to reflect the name change.

Sunday 25 November 2012

How to deploy .wsp file using Visual Studio 2010 for SharePoint 2010


To deploy any solution package in any local environment in Visual Studio 2010 simply right click on the project and deploy. But to deploy the same thing in the production server we will need to deploy through .wsp file.

Right click on the project/solution in Visual Studio 2010 then choose package. If you are building the project/solution in debug mode then you will get the .wsp file inside the Bin\Debug folder and if you are building the project in release mode then you will get the .wsp file inside the Bin\Release folder. This wsp file is needed to deploy in the production environment.

Using browser:

Go to the Central Administration -> Site Actions ->Site Settings -> Galleries –> click on Solutions.
Click on Upload solution and then browse to the wsp file from the ribbon.
Once you will click Ok then activation window will appear. Click on Activate.
Then you can use the solution.

Using PowerShell:

To add a solution using PowerShell:
Open the SharePoint 2010 Management Shell. You can get to this by going to Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell.
Add-SPSolution {path of wsp file}

To deploy the solution using power shell
Install-SPSolution –Identity {path of wsp file}.wsp –WebApplication http:// -GACDeployment

To update solution
Update-SPSolution –Identity {path of wsp file}.wsp –LiteralPath {local path of wsp file}wsp –GACDeployment

To uninstall solution
Uninstall-SPSolution –Identity {path of wsp file}.wsp –WebApplication http://

Remove solution
Remove-SPSolution –Identity {path of wsp file}.wsp

Using Stsadm:

Add the solution
stsadm -o addsolution -filename {path of wsp file}

Deploy the solution
stsadm -o deploysolution -name {path of wsp file} -url {URL}

Retract solution:
stsadm.exe -o retractsolution -name {path of wsp file}.wsp –URL

Delete Solution
stsadm.exe -o deletesolution -name {path of wsp file}.wsp

Saturday 17 November 2012

How to backup individual page in sharepoint



1. Open the site in sharepoint designer and select(or (highlight) the page you want to backup.
2. Goto File -> Save As and save it to your local desktop.
       or
   Click on the "Export File" option from the ribbon and save it to your local desktop.
3- Copy the file which you saved in the desktop.
4- Go to your production, open your site collection in the sharepoint designer.
5- Go to site pages -> Paste the file which you copied.
   Sharepoint designer automatically saved the page in the database.
6- Open the page using browser by navigating your site.

Thursday 15 November 2012

Change Central Administration port number in SharePoint 2010


1- On the Start menu, click All Programs.
2- Click Microsoft SharePoint 2010 Products.
3- Click SharePoint 2010 Management Shell.
4- At the Windows PowerShell command prompt, type the following command:
               
                    Set-SPCentralAdministration -Port <PortNumber>

     Ex- Set-SPCentralAdministration -Port 30217


Note : The Set-SPCentralAdministration cmdlet blocks the following ports:
           Lower than 1023
           Higher than 32767
           443 (SSL)

1- If you want to set the Central administration port to a port below 1023 then run the below command in Windows PowerShell command prompt
                 stsadm -o setadminport -port 81
2- Reset the IIS.
                 iisreset -noforce

How to change web application port number in sharepoint 2010


1st Way :

1- First open "Centeral Administration" ---> "Manage web applications" then select the site which you want to change the port for it, after that go up left and click the small arrow of delete button it'll open a menu, choose "Remove sharepoint from iis web site".
2- It'll open a popup box, choose your site from the drop-down-menu and choose "Yes" for (delete iis web sites)
3- If you go to your IIS manger you'll not find the site now.
4- Now we need to re-add our site with the new Port. From the same position, choose your site again then go up left and click "Extend" button.
5- Now a new popup window will appear, choose "Create a new iis web site" and add your new "Port".
6- Browse your site.

2nd Way :

1- First open "Centeral Administration" --->  Click Application Management ---> Click Configure Alternate Access Mapping ---> Click the web application you are trying to alter --->  Change the port number by altering the URL and click on Save.
2- Open IIS Manager ---> Select the SharePoint site that corresponds with the web application above  ---> Click Bindings ---> Select the current port ---> click Edit ---> change the port number ---> Save.

Saturday 10 November 2012

Your client does not support opening this list with Windows Explorer


1. On Windows Server 2008 Install "Desktop Experience" Feature. This will install the "Web Client service. Keep it to Automatic and make sure its Started.
2. Use IE 8 32 bit version and browse the SP site and check the explorer view. By Default it will open IE 8 64 bit version which continues to give the error regardless the "Web Client" service being started.

To install Desktop experience see the below link.
http://www.youtube.com/watch?v=cOyRFP6KuEI

Friday 9 November 2012

Create a blog site in Sharepoint 2010


1. Go to Site Actions - New Site
2. Click on Blog and enter a title as well as the desired URL name of the blog site, then click on Create.
3. Your new blog site will be successfully created.
4. To create a new post click on "Create a Post" option in "Blog Tools" category in the top right hand side of the page.
5. Then enter your post information and click on "Publish".
   -> Click the Publish command button to save the post as ready for public display. Once the publishing date has been reached, the post will automatically display on your site.
   -> Click the Save as Draft command button to save your current edit – the post will not be displayed to site visitors until you publish the post at a later time.
6. Your post will appear on the blog.


Publish a Blog Post previously saved as a Draft

To publish a blog post that you previously saved, follow these steps:

Click Manage Posts from the Blog Tools menu.
Check one or more posts whose Approval Status indicates Pending.
Select the Items tab from the List Tools ribbon menu.
Click Approve/Reject.
Select the Approved option from the popup dialog.
Click OK.

Calender Overlay In Sharepoint 2010


Calendar overlay is a new feature of SharePoint 2010. Basically it is used to display several calendars in one view. It’s possible to overlay different views of the same calendar – this helps to display colour-coded events in one calendar. It allows the user to create color-coded events in a calendar based on user-defined event categories, out of the box.

1. First create a calender list. Go to Site actions -> Click on More options.
2. Choose list from left side and choose calender form right side & give the name of calender list and click on create.
3. Add some items of different types such as meeting,business,holiday etc.
4. You can change the ouput format by selecting month,day or week format from the ribbon.
5. If you want to show the output in a colored format like meetings created will show in pink or business created will show in blue then in that case you have to use calender overlay feature.
6. Suppose there are three types. i.e. meeting,business,holiday. Then you have to create 3 new calender views for that first.
7. To create views click on calender option from ribbon -> click on create view option.
8. Choose calender view.
9. Give a suitable name for the view. In the filter option choose the column name from which you want to match such as Title, then choose "begins with" option from second drop down, enter the correct name in the textbox. Click on ok.
10. Repeat the above procedure again 2 times to create another 2 views.
11. Now the time to create calender overlay. Chhose the calender list. Click on calender from ribbon -> click on calender overlay.
12. Add each of colour-coded views by clicking New Calendar link.
13. Give the calender name,chhose the color from color drop down.
14. Click on Resolve button under the Web Url text box. It will show all the List names in the List drop down. Choose the name of the calender list from drop down .
15. All the view names for that calender list will show in the List view drop down. Choose your required List view. Click on OK.
16. Repeat the above step again for another two times.
17. Navigate to the list it will show in colored format settings by you.
18. If here extra lines will appear for every entry then do one thing.
19. Go to ribbon, click on calender -> modify view -> in the settings page set a false condition like title begins with tt.
20. Click on Ok. Now you will get your required output.

Monday 5 November 2012

Create Announcements List using Custom List


Use an announcements list to post news, status,post and other short bits of information you want to share with team members.You can create an announcement by using custom list also.

1. Create a custom list. Go to Site Actions -> More Options.
2. Click on list from LHS -> Custom List. Give a name of custom list and click on create.
3. Create two new columns in the list to give same functionality as announcement. Select Custom List ->
In the ribbon click on list -> List settings.
4. In the list settings page “Create column” option.
5. Create two columns i.e. body – multiline and expires – datetime column.
6. Add the list to the page where you want to disply. Go to page -> click on edit option in top link bar
-> Insert -> Web part -> Choose Lists and Libraries option -> Choose the list from RHS.
7. List will add to the page. Then set the setting for the list.
8. Click on list -> Choose List option from ribbon -> Modify View.
9. In edit view page choose option from Filter -> set Expires Greater than or Expires equal to [Today].
10. In the result only those records will display which have expired date more than today date.

Saturday 3 November 2012

Allow Enable Anonymous Access In SharePoint 2010 Sites


1. Open SharePoint 2010 Central Administration, Go to Application Management -> Manage Web Applications.
2. Select Your Site which you want to give anonymous user access and click on Authentication Providers icon in the top ribbon bar.
3. Click on Default Zone. Check the Enable Anonymous Access CheckBox and click on save.
4. Select your site and click on Anonymous Policy Icon In ribbon.
5. Select Default Zone from dropdown and select the permissions option you want to grant to anonymous users Selecting "None - No Policy" is recommended.
6. Close Central Administration and open your site collection for which you just had set anonymous access,   in browser with administrator account.
7. Click on Site Actions -> Site Permissions.
8. Click on Anonymous Access Icon on the top ribbon.
9. Select Entire Web Site Option and click on OK.

You can see the video tutorial by following the below link :
http://www.youtube.com/watch?v=RIxjKImNLUQ

Tuesday 30 October 2012

The operation could not be completed in MS-InfoPath


If the error: “Microsoft InfoPath. The operation could not be completed” arises, it would actually mean that you haven’t created a top level site collection.
First go to your Admin Site then follow the steps below.
On Site Collections, click on the Create site collections link.
Then from the drop down list, Select the web application where you wanted to create the site collection.
Give the title and the description then select “/” from the URL drop down list.
Then choose a template for your site and enter the primary site collection Administrator and OK.

Friday 26 October 2012

Server Error in ‘/’ Application


In SharePoint 2010 we would go into IIS, find our virtual directory and change the CallStack from false to true and the customErrors mode from On to Off.

Go to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config and set Customerrors mode="Off".

If still error will arrise then do the following:

Go to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\ADMIN\web.config

From customErrors section set the value to off.

Sunday 21 October 2012

How to Import Export a SharePoint Subsites

1. Navigate to Central Admin
2. From the Central Admin screen – select ‘Backup and Restore’











3. Form here click ‘Export a site or list’ from the Granular Backup links:





4. Select the relevant Site collection from the drop down






5. Once you’ve selected the Site collection, site and list select a file location (note the .cmp file extension and the fact that it needs to be a network location)
6. Select the version number: 





7. You’re now good to go and can hit ‘start Export’
8. Once you’ve started the Export, you’ll get a screen notifying you about the status









9. Once done you’ll notice 2 files:
          i)   The actual file
          ii)   A log file which is handy in case things don’t go so well.
10. SharePoint 2010′s Central Admin doesn’t have a UI to facilitate the importing of this so you’ll have to use PowerShell .
11. Open the PowerShell  in Administrative mode nad type the below command.
Import-SPWeb -Identity http://win-8qo9cqdq6hn:13000 -Path c:\Backupsharepoint\Customer11000.cmp -includesecurity –force
12. Upon navigating back to your SharePoint list you should notice it on the root /homepage of your site which is where it was imported to.


Using stsadm
Open the Command Prompt on the SharePoint server as an administrator.

C:\>stsadm -o export -url  http://siteurl/site1 -filename c:/site1.cmp -includeusersecurity

C:\>stsadm -o import -url http://newsiteurl/site1 -filename c:/site1.cmp -includeusersecurity

Survey in sharepoint 2010


1. Open your site collection.
2. Go to Site Actions ->Click on All site content option.
3. Then click on create option on the top.
















4. Select survey from the options and give some name and click on create.












5. A new page will open in which you will enter a question or questions for the survey.



















6. Type the required question in the question box.
7. Choose how the answer will show. A number of options are there. Choose the required one.
8. If you want that user have to response to that question then select “Yes” on “Require a response to this question”.
9. If you want that the users will enter different values without any similarity with each other then Choose “Yes” on “Enforce Unique values”.
10. Enter the options you want to show for the question.
11. Choose the option how you want to show the options i.e. in drop down or  in radio button etc.














12. If you want to add another question in the survey then click on “Next Question” button otherwise choose “Finish” button.
13. Survey option will show in LHS navigation pane.

Facebook Integration in asp.net

Thursday 18 October 2012

How to embed and Integrate Youtube Videos in SharePoint 2010 Web Part


1.   Go to YouTube.com and get to the page where your desired video resides. Right click on the video and choose "copy embed html".
2.   Create a Web Part Page or modify an existing page thats going to display the video content and add a Content editor webpart into it.
3.   Modify the content editor webpart and paste the embed html code by clicking "Source Editor".
4.   Click Ok, and publish the page.

Friday 12 October 2012

Add to Bookmark Link using JS


<script language="javascript" type="text/javascript">
function addBookmark()
{
    bookmarkurl = document.URL;
    bookmarktitle = document.title;
    if (document.all)  //Check the condition for IE
        window.external.AddFavorite(bookmarkurl, bookmarktitle)
    else if (window.sidebar) // Check the condition for Mozilla
   {
       window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
   }
}
</script>

<a href="javascript:addBookmark();">Bookmark this page!</a>

Wednesday 10 October 2012

Cannot be deployed as part of a sandboxed solution error.


I was getting below error while activating the wsp file.

This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution 'bfff2747-9497-4cd7-8c7a-af8f5c7d8ad9' failed validation, file manifest.xml, line 3, character 61: The 'ResetWebServer' attribute is not declared.

Solution : Go to Central Administration  -> System settings -> select the option "Manage farm solutions".
In that page you can deploy your solution.

Friday 5 October 2012

How to add a Google Map to a SharePoint Server 2010 page


1.   Open Google Maps page.
2.   In the Text Box, enter the address you want to display.
3.   Click on the Link button above the map on the right.
4.   Click on the Customize and preview embedded map link located on the bottom.
5.   A second Google Maps window will now open. This window will provide you with some options for customizing the map view.
6.   Select the appropriate or custom map size you wish to display on your Web page.
7.   Copy the HTML map link code contained in Section 3 at the bottom of the page.

1.   Open your SharePoint collection.
2.   Select the page in your site where you will be placing the map.
3.   From the Site Actions drop down menu, select Edit Page.
4.   Place the cursor in the page where you want to add a Content Editor Web Part.
5.   In  the ribbon, click on the Insert tab -> Click the Web Part.
6.   Click the Media and Content category, and then click Content Editor.
7.   Click Add.
8.   In the Content Editor Web Part, click Click here to add new content.
9.   In the Format Text tab of the ribbon, click HTML, and then click Edit HTML Source.
10.  In the HTML Source window, paste the code for the embeddable map, and then click OK.
11.  On the Page tab on the ribbon, click Save & Close.

Wednesday 3 October 2012

SharePoint 2010 site templates not showing in create site page, How to get them?

1.            I have created a simple publishing site in SharePoint 2010 server and below is the screen which looks like by default.

      2.            And I like to create a blog site inside it. And I go to Site Actions and selected Create a site and below is the screen I saw.











     3.     But,  here I am not able to see all site templates available in the system. By default it is showing only two. So, How to create a blog site now? How to get all the site templates back?
     4.     It just simple and follow this. Go to Site settings and move to the section "look and feel" as shown in below screen







     5.    If you see, there is a link named "Page layouts and site templates". That is what we needed. Just click on that link.
     6.    Now, below is the screen you see, which has the complete list of site templates and page layouts available in the system.
    7.    If you see the above screen, there are only two templates selected by default. This is the reason why we see only two templates available on the create site page. So, add how many templates you want from the left side. You can do the same with page layouts too. Select all page layouts you needed and save it.

Monday 1 October 2012

Backup/Restore a sharepoint site collection

1. Verify that the user account performing this procedure is a member of the Farm Administrators group. Additionally, verify that the Windows SharePoint Services Timer V4 service has Full Control permissions on the backup folder.

2. In Central Administration, on the Home page, in the Backup and Restore section, click Perform a site collection backup.

3. On the Site collection backup page, select the site collection from the Site Collection list.

4. Type the local path of the backup file in the Filename box.

5. Click Start Backup.

6. You can view the general status of all backup jobs at the top of the Granular Backup Job Status page in the Readiness section. You can view the status for the current backup job in the lower part of the page in the Site Collection Backup section. The status page updates every 30 seconds automatically. You can manually update the status details by clicking Refresh. Backup and recovery are Timer service jobs. Therefore, it may take several seconds for the backup to start.

7. If you receive any errors, you can review them in the Failure Message column of the Granular Backup Job Status page.

8. Next create a new web application (don't create site collection in it).

9. Open Sharepoint 2010 managenment shell in administrator mode. Go to start -> All progrmas -> Microsoft sharepoint 2010 products -> Sharepoint 2010 Management Shell. Right click on it and open as an administrator.

10. Restore-SPSite -Identity "http://localhost:30" -Path "c:\backup\backup30.bak" -force

11. Run the site collection.


Using Powershell

backup-spsite -identity http://contosoweb -path \\server\backupshare\backupfile.bak

restore-spsite -identity http://contosoweb -path \\server\backupshare\backupfile.bak

Saturday 15 September 2012

Turn on IncludeExceptionDetailInFaults

If you get following error :

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Then change the following in web.config file.
Go to  behaviors - serviceBehaviors -
<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />

Friday 7 September 2012

Site Collection In Sharepoint


How to delete a site collection in SharePoint 2010?
      1.  Open the Central Administration
      2.  Application Management
      3.  Site collections
      4.  Delete a site collection
      5.  Select the appropriate site link
      6.  Click OK


How to create a site collection in SharePoint 2010?
     1.  Open the Central Administration
     2.  Application Management
     3.  Site collections
     4.  Create site collections
     5.  Select the web application on which you wants to create a site collection
     6.  Enter the name of the site and URL as per your requirements
     7.  Select the template
     8.  Enter the primary and secondary admins
     9.  Select the storage quota that you want to assign
    10.  Click Create


How to Change site collection administrators?
     1.  Open the Central Administration
     2.  Application Management
     3.  Site collections
     4.  Change site collection administrators
     5.  Select the site collection from the dropdown list for which you want to change the admins
     6.  Change the admins as per their ID's
     7.  Click OK


How to change the quota for site collection?
     1.  Open the Central Administration
     2.  Application Management
     3.  Site collections
     4.  Configure quotas and locks
     5.  Select the appropriate site collection from the dropdown
     6.  Assign a new quota as per your requirements
     7.  Click ok


How to View all site collections?
     1.  Open the Central Administration
     2.  Application Management
     3.  Site collections
     4.  Open the Central Administration
     5.  Application Management
     6.  View all site collections
     7.  Select the correct web applications from the dropdown
     8.  You will see the list of site collections underneath



Thursday 26 July 2012

Find Column Name in Database


SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE 'Date%'
ORDER BY schema_name, table_name

Sunday 22 April 2012

Find IP Address of Computer using C#

protected void Page_Load(object sender, EventArgs e)
{
     string _IP = null;
     string strHostName = System.Net.Dns.GetHostName();
     IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
     foreach (IPAddress ipAddress in ipEntry.AddressList)
     {
          if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
         {
              _IP = ipAddress.ToString();
          }
     }
     Response.Write(_IP);
}

Thursday 19 April 2012

How to give rounded shape to Fieldset and Legend using CSS

In the head part:
<style>
        .fieldset1
        {
            border: 2px solid green;
            -moz-border-radius: 8px;
            -webkit-border-radius: 8px;
            border-radius: 8px;
            width: 300px;
        }
        .legend
        {
            background: White;
            border: solid 1px black;
            border-radius: 8px;
            -webkit-border-radius: 8px;
            -moz-border-radius: 8px;
            padding: 3px 1px;
        }
    </style>

In the body part:
<fieldset class="fieldset1">
        <legend class="legend">Shipping Information</legend>
        Hello...
 </fieldset>

Wednesday 18 April 2012

How to use Google Plus like in Asp.net


Place in the head section :
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>

Place in the body section :
<g:plusone size="tall" annotation="none" href="http://sanjeetsatpathy.blogspot.com"></g:plusone>

Sunday 15 April 2012

Credit Card Number validation using JS


// Card Number = Credit Card number
// Card name = Card Type

function checkCreditCard (cardnumber, cardname) {
   
  // Array to hold the permitted card characteristics
  var cards = new Array();

  // Define the cards we support. You may add addtional card types as follows.
 
  //  Name:         As in the selection box of the form - must be same as user's
  //  Length:       List of possible valid lengths of the card number for the card
  //  prefixes:     List of possible prefixes for the card
  //  checkdigit:   Boolean to say whether there is a check digit
 
  cards [0] = {name: "Visa",
               length: "13,16",
               prefixes: "4",
               checkdigit: true};
  cards [1] = {name: "MasterCard",
               length: "16",
               prefixes: "51,52,53,54,55",
               checkdigit: true};
  cards [2] = {name: "DinersClub",
               length: "14,16",
               prefixes: "305,36,38,54,55",
               checkdigit: true};
  cards [3] = {name: "CarteBlanche",
               length: "14",
               prefixes: "300,301,302,303,304,305",
               checkdigit: true};
  cards [4] = {name: "AmEx",
               length: "15",
               prefixes: "34,37",
               checkdigit: true};
  cards [5] = {name: "Discover",
               length: "16",
               prefixes: "6011,622,64,65",
               checkdigit: true};
  cards [6] = {name: "JCB",
               length: "16",
               prefixes: "35",
               checkdigit: true};
  cards [7] = {name: "enRoute",
               length: "15",
               prefixes: "2014,2149",
               checkdigit: true};
  cards [8] = {name: "Solo",
               length: "16,18,19",
               prefixes: "6334,6767",
               checkdigit: true};
  cards [9] = {name: "Switch",
               length: "16,18,19",
               prefixes: "4903,4905,4911,4936,564182,633110,6333,6759",
               checkdigit: true};
  cards [10] = {name: "Maestro",
               length: "12,13,14,15,16,18,19",
               prefixes: "5018,5020,5038,6304,6759,6761",
               checkdigit: true};
  cards [11] = {name: "VisaElectron",
               length: "16",
               prefixes: "417500,4917,4913,4508,4844",
               checkdigit: true};
  cards [12] = {name: "LaserCard",
               length: "16,17,18,19",
               prefixes: "6304,6706,6771,6709",
               checkdigit: true};
             
  // Establish card type
  var cardType = -1;
  for (var i=0; i<cards.length; i++) {

    // See if it is this card (ignoring the case of the string)
    if (cardname.toLowerCase () == cards[i].name.toLowerCase()) {
      cardType = i;
      break;
    }
  }
 
  // If card type not found, report an error
  if (cardType == -1) {
     ccErrorNo = 0;
     return false;
  }
 
  // Ensure that the user has provided a credit card number
  if (cardnumber.length == 0)  {
     ccErrorNo = 1;
     return false;
  }
   
  // Now remove any spaces from the credit card number
  cardnumber = cardnumber.replace (/\s/g, "");
 
  // Check that the number is numeric
  var cardNo = cardnumber
  var cardexp = /^[0-9]{13,19}$/;
  if (!cardexp.exec(cardNo))  {
     ccErrorNo = 2;
     return false;
  }
     
  // Now check the modulus 10 check digit - if required
  if (cards[cardType].checkdigit) {
    var checksum = 0;                                  // running checksum total
    var mychar = "";                                   // next char to process
    var j = 1;                                         // takes value of 1 or 2
 
    // Process each digit one by one starting at the right
    var calc;
    for (i = cardNo.length - 1; i >= 0; i--) {
   
      // Extract the next digit and multiply by 1 or 2 on alternative digits.
      calc = Number(cardNo.charAt(i)) * j;
   
      // If the result is in two digits add 1 to the checksum total
      if (calc > 9) {
        checksum = checksum + 1;
        calc = calc - 10;
      }
   
      // Add the units element to the checksum total
      checksum = checksum + calc;
   
      // Switch the value of j
      if (j ==1) {j = 2} else {j = 1};
    }
 
    // All done - if checksum is divisible by 10, it is a valid modulus 10.
    // If not, report an error.
    if (checksum % 10 != 0)  {
     ccErrorNo = 3;
     return false;
    }
  }

  // The following are the card-specific checks we undertake.
  var LengthValid = false;
  var PrefixValid = false;
  var undefined;

  // We use these for holding the valid lengths and prefixes of a card type
  var prefix = new Array ();
  var lengths = new Array ();
   
  // Load an array with the valid prefixes for this card
  prefix = cards[cardType].prefixes.split(",");
     
  // Now see if any of them match what we have in the card number
  for (i=0; i<prefix.length; i++) {
    var exp = new RegExp ("^" + prefix[i]);
    if (exp.test (cardNo)) PrefixValid = true;
  }
     
  // If it isn't a valid prefix there's no point at looking at the length
  if (!PrefixValid) {
     ccErrorNo = 3;
     return false;
  }
   
  // See if the length is valid for this card
  lengths = cards[cardType].length.split(",");
  for (j=0; j<lengths.length; j++) {
    if (cardNo.length == lengths[j]) LengthValid = true;
  }
 
  // See if all is OK by seeing if the length was valid. We only check the length if all else was
  // hunky dory.
  if (!LengthValid) {
     ccErrorNo = 4;
     return false;
  };  
 
  // The credit card is in the required format.
  return true;
}

How to trim the space using JS


function Trim(str)
{
    while (str.substring(0,1) == ' ') // check for white spaces from beginning
    {
        str = str.substring(1, str.length);
    }
    while (str.substring(str.length-1, str.length) == ' ') // check white space from end
    {
        str = str.substring(0,str.length-1);
    }
    return str;
}

Tuesday 6 March 2012

How to know any table/function is used any query

select * from sys.sql_modules where definition like '%tablename/funName%'

Sunday 4 March 2012

Disable back button using JS

Create 2 page.

In asp1.aspx :
 <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="~/ asp2.aspx " />

In asp2.aspx:
In the body section
hi

<script language="javascript" type="text/javascript">
function DisableBackButton() {
window.history.forward();
}
setTimeout("DisableBackButton()", 0);

</script>





Wednesday 29 February 2012

Phone number validation using JS


if (txtPhone.value == '')
{
   alert("Please enter phone number.");
   txtPhone.focus();
   txtPhone.value='';
   txtPhone.style.border = '1px solid red';
   return false;
}
else if (txtPhone.value != "")
{
   var targ=txtPhone.value.replace(/[^\d]/g,''); // remove all non-digits
   if(!targ || isNaN(targ) || targ.length!=10)
    {
        alert("Invalid Phone number.");
        txtPhone.value = "";
        txtPhone.style.border = '1px solid red';
        txtPhone.focus();
        return false;
    }
}

How to find the Procedure Created and Modified date


SELECT name, create_date, modify_date FROM sys.objects
WHERE type = 'P'
order by 3 desc

Tuesday 28 February 2012

How to Scroll Images Regularly

<th height="129" bgcolor="#000000" scope="row">
<marquee height="600" bgcolor="#000000" behavior="alternate" direction="down">
<img width="234" height="181" src="image/nexttdaytech.jpg">
<img width="234" height="181" src="image/quants.jpg">
<img width="234" height="181" src="image/java.jpg">
<img width="234" height="181" src="image/connelly.jpg">
<img width="234" height="181" src="image/1.jpg">
<img width="234" height="181" src="image/JobPlacement.jpg">
<img width="234" height="181" src="image/header_placement.jpg">
<img width="234" height="181" src="image/placement.jpg">
<img width="234" height="181" src="image/placement.gif">
</marquee>
</th>

OR

<div style="float: left;height: 180px;padding: 10px;width: 210px;>
<marquee direction="up" scrollamount="2" behavior="scroll"><p>An Adobe&reg; Dreamweaver&reg; CS3 site is a collection of all of the files and assets in your website. You can create web pages on your computer, upload them to a web server, and maintain the site by transferring updated files whenever you save them.</p><br>
        <p class="smallblue">Sanjeet(Web Developer)<br>Passion</p>
        <p class="smallblue">&nbsp;</p>
        </marquee>
</div>

Wednesday 11 January 2012

Call Server Side Function From Javascript


In design :
In the head section:

 <script type="text/javascript" language="javascript">
    function callme(chkCall)
    {
       var chkCall=document.getElementById(chkCall);
       if(chkCall.checked==true)
        {
             chkCall.checked=true;
             PageMethods.GetContactName();
        }
        else
        {
              chkCall.checked=false;
        }
    }
    </script>

In the body section:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
<asp:CheckBox ID="chkCall" runat="server" />

In the CS part :

protected void Page_Load(object sender, EventArgs e)
    {
        chkCall.Attributes.Add("onclick", "javascript:callme('" + chkCall.ClientID + "')");
    }

    [System.Web.Services.WebMethod]
    public static void GetContactName()
    {
        Response.Write("your name");
    }

Monday 2 January 2012

Resize the TextBox dynamically according to text


<script type="text/javascript">
function setHeight(txtNote) {
txtNote.style.height = txtNote.scrollHeight + "px";
}
</script>

In the body :
<asp:TextBox ID="txtNote" runat= "server" TextMode="MultiLine"  onkeyup="setHeight(this);" onkeydown="setHeight(this);" />

Add to Bookmark using JS


<script language="javascript" type="text/javascript">
function addBookmark() {
bookmarkurl = document.URL;
bookmarktitle = document.title;
if (document.all)  //Check the condition for IE
window.external.AddFavorite(bookmarkurl, bookmarktitle)
else if (window.sidebar) // Check the condition for Mozilla
{
window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
}
}
</script>

In the body part :
<a href="javascript:addBookmark();">Bookmark this page!</a>

Show Tooltip in DropDown list items

In design Page :

<asp:DropDownList ID="DropDownList1" runat="server" ondatabound="DropDownList1_DataBound">
</asp:DropDownList>

In CS page :

protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dTable = new DataTable("Dynamically_Generated");
        DataColumn name = new DataColumn("Name", typeof(string));
        dTable.Columns.Add(name);
        dTable.Rows.Add("sanjeet");
        dTable.Rows.Add("ajay");
        dTable.Rows.Add("sonu");
        dTable.Rows.Add("dipu");
        DropDownList1.DataSource = dTable;
        DropDownList1.DataTextField = "Name";
        DropDownList1.DataValueField = "Name";
        DropDownList1.DataBind();
    }
    protected void  DropDownList1_DataBound(object sender, EventArgs e)
    {
        DropDownList ddl = sender as DropDownList;
        if (ddl != null)
        {
            foreach (ListItem li in ddl.Items)
            {
                li.Attributes["title"] = li.Text;
            }
        }
    }