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

[Solved] Restrict expand option

2 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jayanthy
Top achievements
Rank 1
Jayanthy asked on 18 Jun 2008, 01:59 PM
I've a master table and 2 details table in my grid. In one of the detailtables, I want to disable the expand grid option(not show the details table) based on the value of grid bound column. In the following, when the detailtable questions is binded, I want to check the value of  the column "Type", if it's text box, I want to disable the expand column button. Could someone tell me how to do this?

<DetailTables>
<telerik:GridTableView DataKeyNames="QuestionID" Name="Questions" CommandItemDisplay="Top" Width="100%">
<Columns>
<telerik:GridBoundColumn DataField="QuestionID" HeaderText="ID" UniqueName="QuestionID" Display="false" ReadOnly="true" />
<telerik:GridBoundColumn DataField="Type" HeaderText="Type" UniqueName="Type" />
</Columns>
</telerik:GridTableView>
</DetailTables>

2 Answers, 1 is accepted

Sort by
0
Jayanthy
Top achievements
Rank 1
answered on 18 Jun 2008, 06:59 PM
I've resolved this. I added an ItemDataBound event and achieved the functionality.
protected void uxForms_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
       
            if (e.Item.OwnerTableView.Name == "Questions")
            {
                if (e.Item is GridDataItem)
                {  
                     GridDataItem dataItem = e.Item as GridDataItem;
                    TableCell cell = dataItem["ExpandColumn"];
                   ImageButton expandCollapseButton = cell.Controls[0] as ImageButton;
                    string s = dataItem["Type"].Text;
                    if (dataItem["Type"].Text == "Text Box" || dataItem["Type"].Text == "Text Area")
                        expandCollapseButton.Attributes["disabled"] = "true";
                   
                    
                 }  
            }
       
    }
0
Shinu
Top achievements
Rank 2
answered on 19 Jun 2008, 05:50 AM
Hi Jayanthy,

You can also have a look at the following help article.
Hiding expand/collapse images when no records

Shinu.
Tags
Grid
Asked by
Jayanthy
Top achievements
Rank 1
Answers by
Jayanthy
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or