Hi,
I have created a column at runtime that I need to be able to modify and add a checkbox in the header. This checkbox should enable the user to select all / unselect all items in the ultrawebgrid. If anyone knows please tell me how I can add this checkbox to the header at runtime and make this happen. I tried doing
Dim CheckAll As New CheckBox
column.HeaderItem.TemplateControl.Controls.Add(CheckAll)
but this did not work. I have to create this at Runtime since the column is also created in Runtime, all examples I found so far show how to do this in design. Any help is greatly appreciated
its better to do this in the grid_init event and dont use a dim checkall as new checkbox but rather set the text to somethinglike <div><input type='checkbox' name='checkall' value='false' onclick='CheckAllRows();'></div> then just write a JS functionscalled CheckAllRows() and grab a handle to the grid and loop through the rows and check the boxes.
I have done same thing for me in UltraWebGrid but I am encountering following issues :
When I filter the content client side and click on Select all check box it also select the hidden rows. To get rid of this issue I used following code and it seems working fine. But when grid is grouped on any column this doesn't work for me.
{
count++;
}
selectedIds = selectedIds.substring(0, selectedIds.length );
2 When Grid is grouped on some column than this select all work only for first grouped rows as well as select all other rows of other grouped rows. this loop through selection doesn't work for other groups.
Please advice, it is urgently required.
Thanks I did that and made a JS function to loop through rows and check the boxes however I have two questions regarding this.
1) How can I retrieve this checkbox on the page load so I can make it checked again as the user moves through different pages in the grid.
Right now I inserted a html hidden field and if the user selected this, changed its value to "ALL" now in the page load event, I am trying
to do something like datagrid.FindControl("checkall") but it cannot find it, is it because it is being created in runtime? can you tell me how to access this checkbox again after the page is reloaded.
2) Can you tell me the correct way to enable paging on the ultrawebgrid since this grid is being binded on the page index change and as a result doing something like datagrid.rows.count only gives the number of rows in the current page which is set to 10.