Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
6
Answers
Datagrid problem with paging and check boxes...
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
viktors
20y
4.9k
1
Reply
hi all, i have a datagrid with a display checkbox column and the datagrid supports paging. paging is working fine but when i change the page the checked items on the previous page are not being retained. only values checked in the last page are being retained..how can i retain all the checked items from all the pages.. thank's my code looks something like this:
Select
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { sql = "select * from table1 where type=" + "'"+ mytext +"'" + "order by id"; People.DataSource = CreateDataSource(); People.DataBind(); } } public void Page_Grid(Object sender, DataGridPageChangedEventArgs e) { sql = "select * from table1 where type=" + "'"+ mytext +"'" + "order by id"; // Set CurrentPageIndex to the page the user clicked. People.CurrentPageIndex = e.NewPageIndex; // Rebind the data. People.DataSource = CreateDataSource(); People.DataBind(); } public ICollection CreateDataSource () { //getting the connection from the web.config file. SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["connString"]); SqlDataAdapter db_sqladaptor = new SqlDataAdapter(sql,conn); DataSet ds = new DataSet(); db_sqladaptor.Fill(ds,"MyDataResult"); DataView myView = ds.Tables["MyDataResult"].DefaultView; conn.Close(); return myView; } private void Button1_ServerClick(object sender, System.EventArgs e) { DataGridItemCollection items = People.Items; for (int i=0; i
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
set up creation problem
Winform stick to the desktop and only desktop