RadGrid for ASP.NET

Binding description (.NET 1.x) and Bind() method (.NET 2.0) Send comments on this topic.
Populating the control with data > Binding description (.NET 1.x) and Bind() method (.NET 2.0)

Glossary Item Box

When you use GridTemplateColumn with DataBinder.Eval(Container.DataItem, "ColumnUniqueName") binding expression (under .NET 1.x), the value from the respective cell in the grid data-source will be fetched one way only, i.e. only for editing.
It will not be available when you try to get it through the ExtractValuesFromItem method on Update command.

In order to have this value accessible both on editing and updating, you will need to specify appropriate BindingsDescription declaration.
Here is an online example which illustrates this approach:

http://demos1x.telerik.com/aspnet/Grid/Examples/DataEditing/ExtractValues/DefaultCS.aspx

and more precisely the respective section which holds this definition:

ASPX/ASCX Copy Code
<rad:GridTemplateColumn HeaderText="Ship Postal Code" Visible="false"
 
UniqueName="TemplateColumn">
    
<EditItemTemplate>
     
<span style="color:green;">Template column, that will be updated,
       automatically
</span>
          
<br />
         
<asp:TextBox ID="tbShipPostalCode" Runat="server" Text='<%# DataBinder.Eval
          
(Container.DataItem, "ShipPostalCode") %>'>
         
</asp:TextBox>
    
</EditItemTemplate>
     
<BindingsDescription>
       
<rad:BindingDescription ControlID="tbShipPostalCode" PropertyName="Text"
        
DataField= "ShipPostalCode"></rad:BindingDescription>
     
</BindingsDescription>
</
rad:GridTemplateColumn>


You can find more info about the BindingDescription members here.

Under .NET 2.0 framework you can use the newly introduced Bind() syntax:

ASPX/ASCX Copy Code
<EditItemTemplate>
  
<asp:textbox id="TextBox7" runat="server" text='<%# Bind(a?Country") %>'>
  
</asp:textbox>
</
EditItemTemplate>

Here are two online examples (in C# and VB.NET) which demonstrates this approach:

http://www.telerik.com/demos/aspnet/Grid/Examples/DataEditing/TemplateFormUpdate/DefaultCS.aspx 

http://www.telerik.com/demos/aspnet/Grid/Examples/DataEditing/TemplateFormUpdate/DefaultVB.aspx


Note: with the Bind() syntax mentioned above you will be able to extract the updated by the user value from the FormTemplate without any additional code and pass it directly for the Automatic update operation through the DataSource control (see Automatic DataSource operations).