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

Set RadGrid Visibility on page load client side

1 Answer 330 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jasear
Top achievements
Rank 1
jasear asked on 20 Jun 2013, 01:43 PM
Hi,

I have a scenario where I need to set the visibility of a radgrid on page load however I am not able to get the radgrid client side object. Please look at the code below:

$(function () {          
      var grid = $find("<%=RgTabularView.ClientID%>");     
      alert(grid);
      if (grid != null) {           
      }
   });

It always returns null.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jun 2013, 01:55 PM
Hi,

Try the following js to set the visibility on page load.
ASPX:
<telerik:RadGrid ID="grid1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="true" style="visibility:hidden">
</telerik:RadGrid>

JS:
function pageLoad()
  {
      var grid = $find("<%=grid1.ClientID%>");
      grid.set_visible(true);
  }
Note: If you are setting Visible property as false in aspx then its not possible to access the control via js. So in order to set visibility and access via js you can set visibility using CSS.

Thanks,
Shinu.
Tags
Grid
Asked by
jasear
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or