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

obtaining cell values of template columns

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rohit
Top achievements
Rank 1
rohit asked on 21 Jan 2011, 05:35 AM
How to obtain cell values of template columns in RadGrid to insert that value in SQL database.
Can anyone have sample code for that. Please help.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Jan 2011, 07:00 AM
Hello Rohit,

I suppose you want to access the EditItemTemplate in insert mode. If so access the control using findControl method as shown below.

c#:
if (e.Item is GridEditFormItem && e.Item.OwnerTableView.IsItemInserted)
       {
           GridEditFormItem editform = (GridEditFormItem)e.Item;
           TextBox txt1 = (TextBox)editform.FindControl("TextBox1");
           string edit = txt1.Text;
       }

aspx:
<telerik:GridTemplateColumn HeaderText="Price">
      <EditItemTemplate>
              <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("EmployeeID") %>'></asp:TextBox>
      </EditItemTemplate>
</telerik:GridTemplateColumn>

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