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

Error on show/hideColumn at js runtime

2 Answers 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shannnon
Top achievements
Rank 1
Shannnon asked on 17 Feb 2011, 02:35 AM
I followed the samples of show/hide column using client event, however I get js runtime error on the line "var a=this.get_columns()[b].Display=a" that says "get_column()[...] is null or not an object", i am pretty sure that I passed the right index. Any ideas?

Thanks a lot!

Shannon

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Feb 2011, 09:52 AM
Hi Shannon,


I guess the problem in your code "var a=this.get_columns()[b].Display=a" is the "this" pointer which is not actually radgrid client object. You could use "sender" object if you are trying the code in grid event.
function OnRowSelected(sender, args) {
    var grid = sender;
   // rest of your code
}


Otherwise use $find() to get reference to grid object.
Getting RadGrid client object

Now, for hiding the row, call the hideColumn() and pass column index.
hideColumn
The same is demonstrated here for hiding column: demo


-Shinu.
0
Shannnon
Top achievements
Rank 1
answered on 17 Feb 2011, 06:57 PM
I did use $find() to get RadGrid client id, but the error is still there, so i tried to do it in code behind to get around with it and it worked. Thank you anyway!
Tags
Grid
Asked by
Shannnon
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Shannnon
Top achievements
Rank 1
Share this question
or