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

Show columns on client-side

3 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 10 May 2009, 03:42 PM
Hello,

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.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 May 2009, 04:03 AM
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

Thanks
Princy.
0
towpse
Top achievements
Rank 2
answered on 11 May 2009, 08:40 PM
Princey,
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" 
        Skin="Office2007"
        <MasterTableView runat="server" AutoGenerateColumns="false" CommandItemDisplay="None" 
            GridLines="None" GroupLoadMode="Client" TableLayout="Fixed"
            <Columns> 
                <telerik:GridBoundColumn UniqueName="Name" DataField="Name" HeaderText="Data Object"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="Value" DataField="Value" HeaderText="Value"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="TimeStamp" DataField="TimeStamp" HeaderText="Time Stamp"
                    <HeaderStyle Width="150px" /> 
                </telerik:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
        <ClientSettings AllowGroupExpandCollapse="true" AllowKeyboardNavigation="true" EnableRowHoverStyle="true"
            <Resizing AllowColumnResize="true" /> 
            <Scrolling UseStaticHeaders="true" AllowScroll="true" ScrollHeight="100%" /> 
            <ClientEvents OnRowDataBound="RowDataBound" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
0
Sebastian
Telerik team
answered on 12 May 2009, 08:07 AM
Hi towps,

Please review the reply I provided in this forum thread:
http://www.telerik.com/community/forums/aspnet/grid/grid-border-problem-in-skin-office2007.aspx

Best regards,
Sebastian
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.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
towpse
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or