.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 31st, 2004, 08:40 AM
prssenthilkumar prssenthilkumar is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 prssenthilkumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Allow paging

how to do allow paging and also allow custom paging in datagrid in asp.net?

Reply With Quote
  #2  
Old September 15th, 2004, 06:55 AM
akashthakural akashthakural is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Chandigarh
Posts: 6 akashthakural User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 59 sec
Reputation Power: 0
Send a message via MSN to akashthakural Send a message via Yahoo to akashthakural
You have to set AllowPaging property of the DataGrid as true and in the code behind file use a DataDataGridPageChangedEventHandler

private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}

//Intitate
private void InitializeComponent()
{
this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEvent Handler(this.DataGrid1_PageIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);

}

//IN PAGE LOAD
private void Page_Load(object sender, System.EventArgs e)
{

cmd.Connection=shopObj.con; //Connection object
cmd.CommandText="Select * from TABLENAME";
cmd.CommandType=CommandType.Text;
SqlDataAdapter ad= new SqlDataAdapter(cmd.CommandText,shopObj.con);

DataSet ds= new DataSet();
ad.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Allow paging


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT