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

showColumn() Not Working from OnDataBound Client-Side

2 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Online .Net Developers
Top achievements
Rank 1
Online .Net Developers asked on 18 Dec 2008, 11:06 PM
I'm binding data on the Client Side using databind().  I have a client event for OnDataBound() that calls .showColumn or .hideColumn based on what type of user is currently logged in.

The problem is that when I call .showColumn(), it hides the column.  Calling .hideColumn also hides the column.

I call the same JavaScript code from a button and it works fine.

What am I missing?

Thanks.

p.s. I'm using version 2008.3.1125.20 in Visual Studio 2008, IE 7, and Windows XP.

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 22 Dec 2008, 12:38 PM
Hi,

This is a bug and the fix will be included with our first official release for 2009. Please excuse us for the temporary inconvenience this may cause you. I updated your Telerik points for the report.

In the mean time, to avoid this behavior please set Display property to NULL for the column which is hidden if you want to show it again.

Here is a code snippet, which shows the implementation of our suggestion:
        function ClientDataBound(sender, args) { 
            var grid = $find("<%= RadGrid1.ClientID %>"); 
            if ("IsLoggedIn") { 
                grid.get_masterTableView().showColumn(4); 
                grid.get_masterTableView().get_columns()[4].Display = null
            } else { 
                grid.get_masterTableView().hideColumn(4); 
            } 
        } 


The function DataBound() is attached to OnDataBound event.
I hope this information helps.

Regards,
Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Online .Net Developers
Top achievements
Rank 1
answered on 06 Jan 2009, 03:50 PM
That worked.  Thanks!
Tags
Grid
Asked by
Online .Net Developers
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Online .Net Developers
Top achievements
Rank 1
Share this question
or