check box in grid view
-
i have gridview and one of thats column are checkboxes. if i check the top of the check box all of the check boxes checked. but if i paging it and set it that show 5 items in each page just checked 5 checkboxes in first page . but i want all of the checkboxes checked in other pages too.
-
i have gridview and one of thats column are checkboxes. if i check the top of the check box all of the check boxes checked. but if i paging it and set it that show 5 items in each page just checked 5 checkboxes in first page . but i want all of the checkboxes checked in other pages too.
You most probably, you should create an event that updates the datasource for the GridView (particularly the field that is updated with the checkmark value) when you check mark your checkbox. Otherwise, it is not like the other pages exist. They are generated as you move from one page to the next - on demand.
-
i have gridview and one of thats column are checkboxes. if i check the top of the check box all of the check boxes checked. but if i paging it and set it that show 5 items in each page just checked 5 checkboxes in first page . but i want all of the checkboxes checked in other pages too.
Hi, You have to maintain the gridview's data in a datatable which itself should be stored in a viewstate. If the requirement permits you then in checkbox's click event just maintain a flag in the datatable. Otherwise, do it in the PageIndexChanged event of the grid. But, you also need to check the actual row index of the datable which will be dependant to the Per Page data count and the row no. in the data page. Just check it.
Either you love IT or leave IT...