Hi all
i have a check box in one of Template columns of Ultra Webgrid
when user checks the check box i want to check on CheckChanged event that how much Chec boxes are checked. I have done this thing on Server Side. One problem is that how i can get the check box . Means, Like in Grid View we do some thing like this
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk = (CheckBox) row.FindControl("checkBox") (how i can do this thing in ultra web grid)
if(chk.Checked)
//Do some thing
}
2nd thing is that is there any other way i can do this thing instead of Going back to Server each time????
Hello Muhammad,
I believe it is possible to have this scenario. Just remove the postback event on check for each checkbox on the template, set a general "Ok" or "Submit" button below the grid and use the following code to obtain the checked nodes:
<igtbl:TemplatedColumn Key="CustomerID"> <CellTemplate> <asp:CheckBox runat="server" ID="CheckBox1" /> </CellTemplate></igtbl:TemplatedColumn> protected void Button1_Click(object sender, EventArgs e) { TemplatedColumn column = (TemplatedColumn) UltraWebGrid1.Columns.FromKey("CustomerID"); int counter = 0; foreach (CellItem item in column.CellItems) { CheckBox checkBox = (CheckBox) item.FindControl("CheckBox1"); if (checkBox.Checked) { Page.Response.Write("Checkbox on row " + counter.ToString() + " is checked"); } counter = counter + 1; } }
Please, let me know if this helps.
yes . this thing solved my problem, but my situation is that i have to go back to server on each CheckBox checked event.
thanx