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

How can I get the date of "e.Item.Cells[6].Text" in ItemDataBound?

3 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
xiaolin
Top achievements
Rank 1
xiaolin asked on 12 Sep 2008, 02:48 AM
private   void   radgrid_Notices_ItemDataBound(object   sender,   Telerik.WebControls.GridItemEventArgs   e)  
  {  
  if(e.Item.ItemType==Telerik.WebControls.GridItemType.Item||e.Item.ItemType==Telerik.WebControls.GridItemType.AlternatingItem)  
  {   
    e.Item.Cells[6].Text="<a href=Detail.aspx>" + e.Item.Cells[6].Text + "</a>";
  }   
  }   
 
Why I can not get  the data of "e.Item.Cells[6].Text"  in ItemDataBound? 
 How can I get the date of "e.Item.Cells[6].Text" in ItemDataBound?
Thank you !

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Sep 2008, 05:55 AM
Hello Xiaolin,

Try to modify your code a bit:
private void radgrid_Notices_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e) 
    GridDataItem gdi = e.Item as GridDataItem; 
    if (gdi != null
    { 
        gdi["yourColumn"].Text = "<a href=Detail.aspx>" + gdi["yourColumn"].Text + "</a>"
    } 
}    

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
xiaolin
Top achievements
Rank 1
answered on 12 Sep 2008, 09:02 AM
Thank you very much!
Your method is very good!
0
Shinu
Top achievements
Rank 2
answered on 15 Sep 2008, 05:58 AM
Hi xiaolin,

You can also go through the following help article to get more details on how to access cells and rows in RadGrid.
Accessing cells and rows

Thanks
Shinu
Tags
Grid
Asked by
xiaolin
Top achievements
Rank 1
Answers by
Daniel
Telerik team
xiaolin
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or