Add to Google Add to My Yahoo!

Live Chat Here


Articles on ASP.NET

Sunday, June 24, 2007

Using Page Data Source


protected void Page_Load(object sender, EventArgs e)
{
System.Data.SqlClient.SqlDataAdapter ada = new System.Data.SqlClient.SqlDataAdapter("select * from employees",
System.Web.Configuration.WebConfigurationManager.ConnectionStrings ["NorthwindConnectionString"].ConnectionString);
DataTable dt = new DataTable();
ada.Fill(dt);

PagedDataSource objPage = new PagedDataSource();
objPage.DataSource = dt.DefaultView;
objPage.AllowPaging = true;
objPage.PageSize = 1;
objPage.CurrentPageIndex = 4;

GridView1.DataSource = objPage;
GridView1.DataBind();
}
--
Regards,
Munish Kalra

http://kalraonaspnet.blogspot.com
http://munishmca.co.nr