Grab a row value from a template column action event

2 posts, 0 answers
  1. Omarr
    Omarr avatar
    24 posts
    Member since:
    Sep 2008

    Posted 31 Oct 2008 Link to this post

    How do you grab the value of a row from a checkbox checked changed event? This checkbox exist under the template column.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Nov 2008 Link to this post

    Hello Omarr,

    Try out the following code to get the row index or the text in another column of the same row.
     <telerik:GridTemplateColumn UniqueName="Template" > 
             <asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox3_CheckedChanged" />          
     <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" UniqueName="FirstName"

    protected void CheckBox3_CheckedChanged(object sender, EventArgs e) 
            CheckBox chk = (CheckBox)sender; 
            GridDataItem dataitem = (GridDataItem)chk.NamingContainer; 
            // to access the text value from the bound column 
            string strtxt = dataitem["FirstName"].Text; 
            // to get the row index 
            int index = dataitem.ItemIndex; 

Back to Top