Showing posts with label telerik radgrid access on client. Show all posts
Showing posts with label telerik radgrid access on client. Show all posts

Friday, September 26, 2014

Access RadGrid on Client using Javascript/Jquery

To access RadGrid on client, use following code.
I will also show the code that doesn't work:

 
// didnt work. .Net crash saying The Controls collection cannot be modified because the control contains code blocks (i.e. <%--<% %>--%>)
<%--var grid1 = $find("<%= RadGrid1.ClientID%>");--%>

//didnt work. This just gives Null.   
<%--var grid1 = $find("<%# RadGrid1.ClientID%>"); --%> 

//didnt work. This just gives Null.  
<%--var grid1 = document.getElementById('<%# RadGrid1.ClientID%>') --%> 

//didnt work. It give me ID of RadGrid; not a reference to object.  
var grid1 = document.getElementById('RadGrid1').id;  

//This gives reference as htmldiv control which still cant be used to access functions of radgrid.  
var grid1 = document.getElementById('RadGrid1')

  
// THIS WORKS **********************************************
  
var grid = $find(document.getElementById("RadGrid1").id);

var masterTable = grid.get_masterTableView();
  
//********************************************