I have created a templatefield at runtime for checkboxcolumn in gridview using Itemplate Interface and InstanceIn methods.
I have given the id for checkbox also.
I get the checkbox column in gridview successfully.
Now i want to check all the checkbox in gridview.
But when i find checkbox controls in gridview with respect to the id i have given, it returns me nothing.
Following is the code in InstanceIn method of class GridViewTemplat e which Implements Itemplate.
Code for Finding Checkbox Control in GridView.
Error are shown as comments in above code.
I have given the id for checkbox also.
I get the checkbox column in gridview successfully.
Now i want to check all the checkbox in gridview.
But when i find checkbox controls in gridview with respect to the id i have given, it returns me nothing.
Following is the code in InstanceIn method of class GridViewTemplat e which Implements Itemplate.
Code:
Select case ListItemType.Item Case ListItemType.Item Dim chk as checkbox chk=new checkbox chk.id="chkSelRoom" Container.items.add(chk) End Select
Code:
For each row as GridViewRow in dgvRoomDetails.rows
dim ch as checkbox
ch=new checkbox
ch=CType(row.FindControl("chkSelRoom"),checkbox) // returns nothing
ch.checked=true // object reference not set to an instance of the object
End For
Comment