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

[Solved] Disabled row with enabled expand button

2 Answers 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 22 Sep 2009, 07:02 PM
Hi,

I have a radgrid with detail table and i would like to disable certain rows but keep the expand button enabled.
In the grid prerender event i have this code :
foreach (GridDataItem item in (sender as RadGrid).Items)  
{  
    if (DisableRow(item))  
    {  
        item.Enabled = false;  
        item["ExpandColumn"].Enabled = true;  
        (item["ExpandColumn"].Controls[0] as Button).Enabled = true;  
    }  

But this doesn't enable the expandbutton, so i think setting the item to disabled will always force the expand button to be disabled as well.
I could set the font settings so the row would look disabled but then i wouldn't be able to check if it is enabled in client-side code, i need to do that to determine if a contextmenu may be shown or not.

Is there some other way i can achieve this?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Sep 2009, 05:09 AM
Hello Marco,

Try out the following code to achieve the required:
c#:
 protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Master"
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
            { 
                if (col.UniqueName != "ExpandColumn"
                    dataItem[col.UniqueName].Enabled = false
 
            } 
        } 
  } 
Hope this helps...
Princy.
0
Marco
Top achievements
Rank 1
answered on 24 Sep 2009, 09:55 AM
Hi Princy,

Thanks for your help! That's exactly what i needed.

Kind regards,
Marco
Tags
Grid
Asked by
Marco
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Marco
Top achievements
Rank 1
Share this question
or