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

Hide GridTemplateColumn with DropDownList

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 07 Jan 2015, 05:01 PM
Hi, i have a problem, i want to hide a gridtemplatecolumn at selected an option of DropDownList but i cant do it.
My dropdownlist isnĀ“t in the RaidGrid.

This is my dropdownlist:

<asp:Label ID="Label5" runat="server" CssClass="clbl04" Text="Estatus :"></asp:Label>
                                                        <asp:DropDownList ID="ddst" runat="server" Font-Names="Tahoma" Font-Size="8pt" AutoPostBack="false"></asp:DropDownList>

and this is my gridtemplatecolumn:

<radG:GridTemplateColumn HeaderText="Certification Date" UniqueName="TemplateColumn">


1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 12 Jan 2015, 12:46 PM
Hi Alan,

If you would like to modify the structure of RadGrid based on a selection in a dropdown control you can use the approach illustrated in the following article. Note that it illustrates how you can modify the entire structure of RadGrid based on a selected option.

Another option you can use is to hide a column only visually. You can handle the SelectedIndexChanged event of the DropDownList to implement the functionality.

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    if ((sender as DropDownList).SelectedValue == "1")
    {
        RadGrid1.MasterTableView.GetColumnSafe("ColumnUniqueName").Display = false;
    }
}


Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Alan
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or