Friday, May 21, 2010

value does not fall within the expected range in sharepoint Error

Wnen I was working on the authentication part of in my project using forms authentication, I got the error value does not fall within the expected range. I deleted the old page and created a new one and added the webparts to the page. The error got resolved.

Thursday, May 13, 2010

How to Add a Site Template by using stsadm in MOSS 2007

stsadm -o addtemplate -filename “D:\SiteTemplate.stp” -title “Project site template” -description “Project site template with a simple structure”

After adding the site template, the IIS must be reset. The template will be found in Custom site template collection.

Ref: http://blog.gavin-adams.com/2007/07/03/creating-site-collection-templates/

Wednesday, May 12, 2010

How to Save the Site Template in MOSS Site

Suppose you want to save the site template of your existing site in sharepoint, please follow the steps below.

If your site address is like

http://localhost:100/Paintings/Pages/Home.aspx

and you want to save the template of the painting site, then change the URL as

http://localhost:100/Paintings/_layouts/savetmpl.aspx

and press Enter button.

You will be getting a page Save Site as Template and enter the details and select the Include Content checkbox to save your site content and click OK button. The following fogure will be displayed.


After clicking Ok the success page will be displayed as below.

You can go to the site template gallery by clicking on the link Site Template gallery and click Ok to finish the opration.



Tuesday, May 11, 2010

Run time filtering of the records Using Select Expression in DataSet Or in DataTable.


This code is used to write the filter expression in the Dataset runtime.

 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
 {
      string expression = "Id = " + ds.Tables[0].Rows[i][0];
      DataRow[] rows = ds.Tables[1].Select(expression);
      foreach (DataRow row in rows)
      {
        DataRow newRow =                                                  myDescripterValueTable.Tables[i].NewRow();
                        newRow["Id"] = row["Id"];
                        newRow["value"] = row["value"];
                        myDescripterValueTable.Tables[i].Rows.Add(newRow);
      }
 }

How to select unique fields in DataSet or DataTable at runtime in C# & Ado.Net

Please refer the following code to filter the unique values from DataSet or DataTable at runtime.


DataTable dt=new DataTable();
DataTable dt = GetProductDetaila(); // Get all the details of product


DataView view = dt.DefaultView; // Create a dataview on the datatable


view.Sort = "ProductId,ProductName"; // Need to sort the records based on the ProductId and ProductName


DataTable newTable = view.ToTable("UniqueProductNames", true, "ProductId", "ProductName", 
"ImageURL"); 


// These are the unique entries in the dataset that are to be filtered. If you need more fields then write them in comma seperated values.

Friday, May 7, 2010

Walkthrough: Creating a Basic SharePoint Web Part

http://msdn.microsoft.com/en-us/library/ms452873.aspx