Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Template Column with GridDataItem

Answered Template Column with GridDataItem

Feed from this thread
  • Angella avatar

    Posted on May 18, 2012 (permalink)

    Hi all,

    During the OnItemDataBound, I'm using the GridDataItem to retrieve values from the grid. I'm able to do this without the regular columns. The instructions for the Template column said:  For template columns you must find the control in the grid cell and extract its value.please give an example.

    Following is the aspx code for the column :
     <telerik: GridTemplateColumn HeaderText="Unloading Type" UniqueName="UnloadTypeColumn">
                            <ItemTemplate>
                                         <%#DataBinder.Eval(Container.Dataitem, "_UnloadTypeName")%>
                            </ItemTemplate>
    </telerik:GridTemplateColumn>

    Thanks in advance.

    Reply

  • Answer Shinu MVP avatar

    Posted on May 18, 2012 (permalink)

    Hello Angella,

    Try accessing the value as shown below.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
      if (e.Item is GridDataItem)
     {
      GridDataItem item = (GridDataItem)e.Item;
      string s = ((DataRowView)e.Item.DataItem)["UnloadTypeName"].ToString();}
     }
    }

    Thanks,
    Shinu.

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Grid > Template Column with GridDataItem
Related resources for "Template Column with GridDataItem"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Step-by-step Tutorial  ]