I am trying to write some very basic javascript that retrieves an ID from the selected row (active row) of a WebGrid.
My page has a master page (which may be cohntributing to my issues)...
here is the content in my page (at least the script)
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy2" runat="server">
</asp:ScriptManagerProxy>
<script id="settingsClientScript" type="text/javascript">
<!--
function OpenHDWindow() {
var viewid = 0;
alert("before getGrid called.");
var grid = igtbl_getGridById('<%= WebDataGrid1.ClientID %>');
if (grid != null) {
alert("Grid found.");
var row = grid.getActiveRow();
var col = row.getCell(0);
viewid = cell.getValue();
}
else {
alert("grid not found.");
var url = 'DashboardHD.aspx?vid=';
url += viewid;
newwin = window.open(url);
if (window.focus) { newwin.focus() }
return false;
-->
</script>
Hello,
Mike said: var grid = igtbl_getGridById('<%= WebDataGrid1.ClientID %>');
This line shows you are using the WebDataGrid control from the ASP.Net AJAX line and not the UltraWebGrid. The igtbl_getGridById is for the UltraWebGrid and doesn't work for WebDataGrid. Hence it was returning null.
Please replace the above code as follows:
var grid = $find('<%= WebDataGrid1.ClientID %>');
This works for all the ASP.NET AJAX line of controls.
Please visit the following link to learn more about the CSOM of WebDataGrid:
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2009.1/CLR3.5/html/WebDataGrid~Infragistics.Web.UI_namespace.html
Thanks,
Sarita
the line you suggested: