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

Checkbox Value

2 Answers 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cush
Top achievements
Rank 1
Cush asked on 13 Jan 2011, 01:31 PM
Hi All

I have a databound column that has a checkbox in it.

My question is how can i get the checkbox value server side so that i can format another cell based on if its true or false.

Any help would be greatly appriciated.

Rgds

Darren

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jan 2011, 06:28 AM
Hello Cush,

You can try the following code snippet to access the CheckBox value.

aspx:
<Columns>
<telerik:GridCheckBoxColumn HeaderText="CheckBox1" UniqueName="CheckBox1" ReadOnly="false">
</telerik:GridCheckBoxColumn>
<Columns>

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
     if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            CheckBox chk = (CheckBox)item["CheckBox1"].Controls[0]; ;
            Boolean flag = chk.Checked;
        }
      }

You can also refer the following documentation for more on accessing  cells and rows.
Accessing cells and rows

Thanks,
Shinu.
0
Cush
Top achievements
Rank 1
answered on 14 Jan 2011, 10:59 AM
Hi Shinu

That works a treat.

Regards

Darren
Tags
Grid
Asked by
Cush
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Cush
Top achievements
Rank 1
Share this question
or