Show columns on client-side

4 posts, 0 answers
  1. David
    David  avatar
    12 posts
    Member since:
    Aug 2012

    Posted 10 May 2009 Link to this post


    i have following scenario: RadGrid with three columns. The first one is Template column with checkbox inside it. The second one is combobox and the last one is textbox column. I want to show the combo and the textbox column when an user changes the state of checkbox, but without sending the data to server.

    Is is possible to do it on client side? When I set the value of Visible property to false of these two last columns, their content is not rendered in browser, so there must be (I hope :)) some different way how to accomplish this task.

    So, again in a few words: The checkbox is checked = the textbox and combobox columns are editable; checkbox is unchecked = these two columns are not visible.

    Thank you for your help.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 May 2009 Link to this post

    Hello David,

    You can use the hideColumn() and showColumn() client side methods to display or hide your columns based on conditions. Check out the following demo which  illustrates the same:
    Client-side API

  3. towpse
    towpse avatar
    224 posts
    Member since:
    Mar 2008

    Posted 11 May 2009 Link to this post

    I'm having an issue in Firefox where, if I hide all but one column the reamining column is not stretching to fill the grid width. This causes the UI to look incomplete since the cell border does not fill the grid and I have some blank empty space.
    It looks fine in IE though.

    I've looked at the help article you linked and I'm doing everything the same except I am grouping my rows by one of the column values and actually specifying which columns I want to display in the markup. The column collection in the example is empty in the markup.
    I'm not sure if that's causing an issue in Firefox. Using firebug and comparing my grid to the one in that article, when i inspect my column it clearly does not stretch to fill the grid if i hide the other columns whereas in that telerik example, the columns always resize accordingly as expected.

    Here's my grid:

     <telerik:RadGrid runat="server" ID="ViewGrid" GridLines="None" GroupingEnabled="true" 
            <MasterTableView runat="server" AutoGenerateColumns="false" CommandItemDisplay="None" 
                GridLines="None" GroupLoadMode="Client" TableLayout="Fixed"
                    <telerik:GridBoundColumn UniqueName="Name" DataField="Name" HeaderText="Data Object"
                    <telerik:GridBoundColumn UniqueName="Value" DataField="Value" HeaderText="Value"
                    <telerik:GridBoundColumn UniqueName="TimeStamp" DataField="TimeStamp" HeaderText="Time Stamp"
                        <HeaderStyle Width="150px" /> 
            <ClientSettings AllowGroupExpandCollapse="true" AllowKeyboardNavigation="true" EnableRowHoverStyle="true"
                <Resizing AllowColumnResize="true" /> 
                <Scrolling UseStaticHeaders="true" AllowScroll="true" ScrollHeight="100%" /> 
                <ClientEvents OnRowDataBound="RowDataBound" /> 
  4. Sebastian
    Sebastian avatar
    9934 posts

    Posted 12 May 2009 Link to this post

    Hi towps,

    Please review the reply I provided in this forum thread:

    Best regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top