This is a migrated thread and some comments may be shown as answers.

Grid With Check box

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunny
Top achievements
Rank 1
Sunny asked on 07 Mar 2013, 11:38 PM
Hello sir/madam,

I m using checkbox inside the rad grid and when i checked check boxes and click on button(named Add Selected Items) outside the grid than i want to get check boxes checked either true or false but i always got false value wheather i checked and not so please tell me how to get the check boxes true property when i checked and false when its not checked you can see my screen shot that i have attached and currently i m using below code:


1.) ( for (int i = 0; i < Grid_PurchaseOrder_Lines_0.MasterTableView.Items.Count; i++)
       {
     bool isChecked = ((CheckBox)Grid_PurchaseOrder_Lines_0.MasterTableView.Items[i].FindControl("chkcmpny")).Checked;}


2.)     (   foreach (GridDataItem item in Grid_PurchaseOrder_Lines_0.MasterTableView.Items)
     {
            CheckBox chkBoolean = (CheckBox)item["TemplateColumn1"].FindControl("chkcmpny");
            // access your checkbox here

            if (chkBoolean.Checked==true)
            {

            }
        }


I have used both methods but getting same problem. so please tell me asap.

thanks in advance........

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Mar 2013, 04:33 AM
Hi,

I was able to replicate the issue when the grid is binded using simple data binding. If you are using simple data binding, try adding !ispostback in the page load handler.

Thanks,
Shinu
Tags
Grid
Asked by
Sunny
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or