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

How to find the cell value in ItemDataBound

1 Answer 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sagar Baheti
Top achievements
Rank 1
Sagar Baheti asked on 17 Sep 2008, 08:33 AM
Hi,
I am using Radgrid, I have to add tree in  every row. Now i am trying to use following code

   protected void RadGrid4_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            RadTreeView treeview = (RadTreeView)data["Tree"].FindControl("RadTreeView1"); 
            int id=  Convert.ToInt32(dataItem["CategoryID"].ToString()); 
            //Write query to select Name based on the category id for each treeview and              populate Dataset 
            treeview.DataTextField = "Name"
            treeview.DataSource = dsSet
            treeview.DataBind(); 
        } 

but here i can't find the value for id. So could please help me how to find the cell value in ItemDataBound.

Regards,
Sagar

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 17 Sep 2008, 08:38 AM
Hello Sagar,

dataItem["ColumnName"]  is a TableCell object. That is why you should use

int id =  Convert.ToInt32(dataItem["CategoryID"].Text)


Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Sagar Baheti
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or