title: C# telerik grid cell value from template column
body: <p>I have a grid-template-column defined like this( to save time and space i'll only put the column):</p>
  
  <pre><code>&lt;telerik:GridTemplateColumn HeaderText="Id" Reorderable="true" SortExpression="Id" UniqueName="Id" DataField="Id"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblId" runat="server" Text='&lt;%# Eval("Id") %&gt;' /&gt;
                      &lt;/ItemTemplate&gt;
                      &lt;EditItemTemplate&gt;
                          &lt;telerik:RadTextBox ID="txbId" Width="50px" runat="server" TextMode="SingleLine"
                              Text='&lt;%# Bind("Id") %&gt;' /&gt;
                      &lt;/EditItemTemplate&gt;
                      &lt;ItemStyle VerticalAlign="Top" /&gt;
               &lt;/telerik:GridTemplateColumn&gt;
  </code></pre>
  
  <p>And I want on the PreRender event, to extract the value of this column</p>
  
  <pre><code>protected void RadGrid1_PreRender(object sender, System.EventArgs e)
      {
          //string selectedItem = ((GridDataItem)RadGrid1.SelectedItems[0])["Id"].Text;
          foreach (GridDataItem item in RadGrid1.Items)
          {
              //not working
              string k = item["Id"].Text;// is empty string 
              string key = (item["Id"].TemplateControl.FindControl("lblId") as RadTextBox).Text;// null pointer
  }
  </code></pre>
  
  <p>Any idea how to fix it?</p>
  
  <p>Thx a lot.</p>