This is getting frustrating. According to other threads and the examples I should be able to simply hide or not hide a column in javascript with a simple function. The problem is that when I use the hideColumn(x) function, it is not hiding one column, but always two. (Whatever is the next column is hidden as well) This happens regardless of what index I pass to the function. (Though I'm only interested in hiding index 1) I've tried experimenting, but no luck so far. The relevant code is below:
<telerik:RadCodeBlock ID="codeBlock1" runat="server"> <script type="text/javascript"> var grid; function GetGridObject(sender, eventArgs) { grid = sender; } function showType(action) { if (action) { grid.get_masterTableView().showColumn(1); } else { grid.get_masterTableView().hideColumn(1); } } </script> </telerik:RadCodeBlock> <telerik:RadGrid ID="gridLoads" runat="server" AllowPaging="false" EnableEmbeddedSkins="false" AutoGenerateColumns="false" Height="344px"> <MasterTableView CellSpacing="0" CellPadding="0" Width="612px" DataKeyNames="SortOrder" TableLayout="Fixed" ShowFooter="false"> <HeaderStyle BackColor="#FFFFFF" Font-Bold="true" ForeColor="#666666" Font-Names="Arial,Verdana,Sans-Serif" BorderWidth="0" BorderStyle="None" /> <ItemStyle BackColor="#EBECF2" Font-Names="Arial,Verdana,Sans-Serif" /> <AlternatingItemStyle BackColor="#EBECF2" Font-Names="Arial,Verdana,Sans-Serif" /> <NoRecordsTemplate></NoRecordsTemplate> <Columns> <telerik:GridTemplateColumn UniqueName="Title" HeaderText="Title" HeaderStyle-Width="320px" ItemStyle-BorderWidth="1" ItemStyle-BorderColor="#cccccc"> <ItemTemplate> <telerik:RadTextBox ID="txtTitle" Skin="Simple" MaxLength="50" Width="315px" runat="server"> </telerik:RadTextBox> <asp:RequiredFieldValidator ID="rfvTitle" Display="Dynamic" ControlToValidate="txtTitle" ValidationGroup="SaveExp" ErrorMessage="<br/>Please add a title for this item before adding!" EnableClientScript="false" runat="server"> </asp:RequiredFieldValidator> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Type" UniqueName="Type" HeaderText="Type" ItemStyle-BorderWidth="1" ItemStyle-BorderColor="#cccccc" HeaderStyle-Width="93px" Display="false"> <ItemTemplate> <telerik:RadComboBox ID="ddlType" Skin="Simple" Width="90px" runat="server"> <Items> <telerik:RadComboBoxItem Text="Fuel" Value="Fuel" /> <telerik:RadComboBoxItem Text="Chaff" Value="Chaff" /> <telerik:RadComboBoxItem Text="Flares" Value="Flares" /> <telerik:RadComboBoxItem Text="Bomb" Value="Bomb" /> <telerik:RadComboBoxItem Text="Missle" Value="Missle" /> <telerik:RadComboBoxItem Text="Ammo" Value="Ammo" /> <telerik:RadComboBoxItem Text="External Tank" Value="External Tank" /> </Items> </telerik:RadComboBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Weight" HeaderText="Weight" UniqueName="Weight" ItemStyle-HorizontalAlign="Right" ItemStyle-BorderWidth="1" ItemStyle-BorderColor="#cccccc" HeaderStyle-Width="57px" HeaderStyle-HorizontalAlign="Right"> <ItemTemplate> <wyle:NumericTextBox ID="txtWeight" runat="server" ToolTip="Enter Weight Here" MaxLength="10" MaxValue="9999999999.9" Skin="Simple" DecimalPlaces="1" Width="50px" /> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Moment" HeaderText="Moment" UniqueName="Moment" ItemStyle-HorizontalAlign="Right" ItemStyle-BorderWidth="1" ItemStyle-BorderColor="#cccccc" HeaderStyle-Width="79px" HeaderStyle-HorizontalAlign="Right"> <ItemTemplate> <img src="../../Images/calculator_20.png" onclick="openArm(this, '<%=gridLoads.ClientID %>', 7, 10);" title="Calculate moment based on new ARM" alt="Calculate moment based on new ARM" style="vertical-align:middle;" /> <wyle:NumericTextBox ID="txtMoment" runat="server" ToolTip="Enter Moment Here" MaxLength="10" MaxValue="9999999999.9" Skin="Simple" DecimalPlaces="1" Width="50px" /> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings Scrolling-UseStaticHeaders="true" Scrolling-AllowScroll="true" AllowColumnHide="true"> <Resizing ClipCellContentOnResize="false" EnableRealTimeResize="true" AllowColumnResize="true" /> <ClientEvents OnGridCreated="GetGridObject"></ClientEvents> </ClientSettings> </telerik:RadGrid>