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

Something that should be so simple...

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Wallace
Top achievements
Rank 1
Eric Wallace asked on 04 Jun 2010, 03:46 PM
So what I'm trying to do should be very basic, but seems unnecessarily difficult with the radgrid. All I am doing is binding the grid server-side, and need to conditionally set a column to "readonly" if certain criteria is met by the item's dataitem. So my question is how do you set a single item's column to readonly in the ItemDataBound event?

protected void gridFavorites_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item.DataItem != null
        { 
            IFavorite fav = (IFavorite)e.Item.DataItem; 
            if (fav.CmsPageId == Guid.Empty) 
                // Where to go from here to set readonly=true? 
        } 
    } 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jun 2010, 05:56 AM
Hello Eric,

You can try the following code snippet to make the column ReadOnly.

CS:
 if (fav.CmsPageId == Guid.Empty)  
       { 
          (gridFavorites.MasterTableView.GetColumn("ColumnUniqueName"as GridBoundColumn).ReadOnly = true
       } 
 else 
       { 
          (gridFavorites.MasterTableView.GetColumn("ColumnUniqueName"as GridBoundColumn).ReadOnly = false
       } 

Regards,
Shinu.



Tags
Grid
Asked by
Eric Wallace
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or