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

How to get level 2 hierarchy first column value?

2 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Howard
Top achievements
Rank 1
Howard asked on 11 Apr 2013, 12:43 PM
Hi, I have a hierarchy radgrid which have 2 levels,  I bind the data with "<asp:Label ID="lblDescription" runat="server" Text='<%# Bind("DESCRIPTION") %>' />" in my level 2 first column. And I want to DirectCast the label text to another word. How to I get the value of lblDescription? Thanks

2 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 08 May 2013, 09:06 PM
Hello Howard,

I would suggest posting this on the ASP forums to get an answer to this question, if you haven't done so already

Best Regards,
Emanuel Varga
MVP
0
Shinu
Top achievements
Rank 2
answered on 09 May 2013, 11:27 AM
Hi,

You can retrieve the value in itemdatabound event as shown below.
c#
protected void grid_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Detailtable1")
  {
            GridDataItem item = (GridDataItem)e.Item;
            Label lbl = (Label)item.FindControl("lblDescription");
   }
}

Thanks,
Shinu
Tags
GridView
Asked by
Howard
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or