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

CheckBox in RadGrid

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Admir Brkić
Top achievements
Rank 1
Admir Brkić asked on 28 Sep 2010, 01:58 PM
I use GridTemplateColumn and CheckBox in there.
I have event , which fire after I checkChange , this is code behind:

string n = ((sender as CheckBox).Parent.Parent as GridItem).Cells[1].Text;

i need some data from cell, but I get " " , how to fix that.

I would like to change color of checked row, too.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Sep 2010, 02:36 PM
Hi Admir,

Access the cell using "ColumnUniqueName" as shown below.

Code:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
    GridDataItem item = (GridDataItem)(sender as CheckBox).NamingContainer;
    string value = item["ProductID"].Text;
    Response.Write(value);
}


Mark-up:
<telerik:GridTemplateColumn>
    <ItemTemplate>
        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
    </ItemTemplate>
</telerik:GridTemplateColumn>


Thanks,
Princy.
Tags
Grid
Asked by
Admir Brkić
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or