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

[Solved] Create columns at run time and edit it

1 Answer 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jihad
Top achievements
Rank 1
Jihad asked on 19 May 2009, 08:50 AM
Salam,

after create columns at runtime I fill all the cells in grid  (.....cel.Text = "CELL11"),and when I try to edit the rows using EDITMODE="Inplace"
there is an error will display.

is this way to fill cells right, and if not please help me to fill cells and edit it. if its right please help me to edit the cell.

regards,

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 May 2009, 09:41 AM
Hello Jihad,

When you bind your grid to a DataSource and set the DataField for columns then the cells will automatically display the bound field values. You can also refer to the folowing help document for bette understanding:
 Programmatic creation

 If you want to modify your cell text then you would have to try out the following code inorder to avoid errors:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridDataItem)&&!(e.Item.IsInEditMode)) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            item["ColumnUniqueName"].Text = "customText"
        }  
    } 
 

Thanks
Princy.
Tags
Grid
Asked by
Jihad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or