Hello,
I currently have a hierarchical grid where I need to selectively hide certain columns and prevent it from appearing in Add/Edit form. I am able to selectively hide the column but was not able to prevent it from appearing in the Edit Form when user click on Add or Edit
Here is the snippet of one of columns that I need to hide programatically. Note that I am not using GrodBoundColumn and most of my columns are using GridTemplateColumn with ItemTemplate and EditItemTemplate as shown below
Here is the snippet of code use to hide the column
Most of the solution I found online is to make the column readonly. But I am not using GridBoundColumn. Is there a way to prevent it from appearing it in Edit Form when user click on Add or Edit since they are not visible on the Grid. Note that I am using auto generating form.
Your help in resolving this will be greatly appreciated.
Thank you.
-Yoong
I currently have a hierarchical grid where I need to selectively hide certain columns and prevent it from appearing in Add/Edit form. I am able to selectively hide the column but was not able to prevent it from appearing in the Edit Form when user click on Add or Edit
Here is the snippet of one of columns that I need to hide programatically. Note that I am not using GrodBoundColumn and most of my columns are using GridTemplateColumn with ItemTemplate and EditItemTemplate as shown below
<telerik:GridTemplateColumn UniqueName="WellnessFactor" HeaderText="Wellness Factor<span style='color:#CD4800'>*</span>"> <ItemTemplate> <%#DataBinder.Eval(Container.DataItem, "WellnessFactor")%> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox ID="WellnessFactorComboBox" runat="server" AllowCustomText="false" AutoPostBack="false" CausesValidation="false" DataTextField="WellnessFactor" DataValueField="WellnessFactor" EmptyMessage="Please Select..." EnableVirtualScrolling="true" Height="45px" MarkFirstMatch="true" NoWrap="True" Skin="WebBlue" Width="150px"> <Items> <telerik:RadComboBoxItem Text="Yes" Value="Yes" /> <telerik:RadComboBoxItem Text="No" Value="No" /> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator ID="ValidateWellnessFactorComboBox" runat="server" ControlToValidate="WellnessFactorComboBox" ValidationGroup="SubscriberGroup" ErrorMessage="*This field is required" ForeColor="Red" InitialValue=""> </asp:RequiredFieldValidator> </EditItemTemplate> </telerik:GridTemplateColumn>Here is the snippet of code use to hide the column
protected void RadGrid1_OnPreRender(object sender, EventArgs e){ if (listHideColumn.Count > 0) { foreach (GridColumn column in RadGrid1.Columns) { foreach (string columnName in listHideColumn) { if (column.UniqueName == columnName) { column.Visible = false; //(column as GridBoundColumn).Visible = false; break; } } } }}Most of the solution I found online is to make the column readonly. But I am not using GridBoundColumn. Is there a way to prevent it from appearing it in Edit Form when user click on Add or Edit since they are not visible on the Grid. Note that I am using auto generating form.
Your help in resolving this will be greatly appreciated.
Thank you.
-Yoong