
I am a newbie to AJAXing RadControls and having a hell of a time.
Just when i think i have finally got my RadGrid bound to a Web Service i get:
Sys.ArgumentNull Parameter id null
The error is thrown when i call
var tableview = $find("<%= rdScreenings.ClientID %>").get_masterTableView();
I get the correct clientid if i call for that alone. as soon as I add get_ to attach a data source i get the error.
Here is the scripts i am running:
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script language="javascript" type="text/javascript" >
function pageLoad() {
proxy.GetScreeningsByZipCode44212(updateGrid);
}
function updateGrid(results) {
alert("<%= rdScreenings.ClientID %>");
var radgrid = $find("<%= rdScreenings.ClientID %>");
alert('got radgrid');
var tableview = $find("<%= rdScreenings.ClientID %>").get_masterTableView();
alert('before datasource');
tableview.set_dataSource(results);
tableview.dataBind();
}
function refreshData() {
proxy.GetScreeningsByZipCode44212(updateGrid);
}
</script>
</telerik:RadScriptBlock>
// snippets of the html & controls
<asp:ScriptManager ID="scriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/proxy.asmx" />
</Services>
</asp:ScriptManager>
I am using ASPNET AJAX Q1 2009
12 Answers, 1 is accepted
The code you pasted looks fine to me. Therefore I am asking you to send us the project or at least the source of the whole aspx page so that we can help you.
Best wishes,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

Added ClientEvent last night because of a Kevin Babcok's blog.
I now get an error saying a field i know existing in the return doesn't exist
ASP CODE:
<%@ Page Title="" Language="C#" MasterPageFile="~/landingpage.master" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script language="javascript" type="text/javascript" >
// function refreshGridView() {
// var gridView = $find('<%= rdScreenings.ClientID %>');
//// gridView.set_dataSource(result.rows);
// gridView.dataBind();
// }
// function changeZipCode() {
// //alert('<%= txtZCode.ClientID %>');
// var objZipCode = document.getElementById('<%= txtZCode.ClientID %>');
// //alert(objZipCode.value);
// var objZipLabel = document.getElementById('<%= lblZipCode.ClientID %>');
// objZipLabel.innerHTML = objZipCode.value;
// //refreshGridView();
// alert('<%= rdScreenings.ClientID %>');
// var masterTable = $find('<%= rdScreenings.ClientID %>').get_masterTableView();
// masterTable.set_dataSource('<%= odsZipSearch.ClientID %>');
// masterTable.dataBind();
// }
// function refreshData() {
// ECommerce.GetScreeningsListByZipCode44212(updateGrid);
// }
// function assignDataSourceAndRefresh()
// {
// var masterTable = $find("<%= rdScreenings.ClientID %>").get_masterTableView();
// masterTable.set_dataSource(<some_data_source_of_the_specified_type_above>);
// masterTable.dataBind();
// }
function pageLoad() {
proxy.GetScreeningsByZipCode44212(updateGrid);
}
function updateGrid(results) {
alert("<%= rdScreenings.ClientID %>");
var radgrid = $find("<%= rdScreenings.ClientID %>");
alert('got radgrid');
var tableview = $find("<%= rdScreenings.ClientID %>").get_masterTableView();
alert('before datasource');
tableview.set_dataSource(results);
tableview.dataBind();
}
function refreshData() {
proxy.GetScreeningsByZipCode44212(updateGrid);
}
function RadGrid_OnCommand(sender, args) {
//intentionally left blank
}
</script>
</telerik:RadScriptBlock>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="TabPanel">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><asp:Image ID="imgStep1" runat="server" ImageUrl="images/bt-step1.gif" /></td>
<td><asp:Image ID="imgStep2" runat="server" ImageUrl="images/bt-step2-un.gif" /></td>
<td><asp:Image ID="imgStep3" runat="server" ImageUrl="images/bt-step3-un.gif" /></td>
<td><asp:Image ID="imgStep4" runat="server" ImageUrl="images/bt-step4-un.gif" /></td>
<td><asp:Image ID="imgStep5" runat="server" ImageUrl="images/bt-step5-un.gif" /></td>
<td><asp:Image ID="imgTabSpacer" runat="server" ImageUrl="images/spacer.gif" Width="267" Height="2" /></td>
</tr>
<tr>
<td colspan="6">
<asp:Image ID="imgPass1" runat="server" ImageUrl="~/images/landingpage/CommerceTabLine_Landing.jpg" /></td>
</tr>
</table>
</div>
<div id="LandingPageContent">
<div id="PageTitlePanel"><strong>Screening near:</strong> <asp:Label ID="lblZipCode" runat="server" Text="44212"></asp:Label><asp:LinkButton
ID="lbChangeZipPriorty" runat="server">(change location or priority code)</asp:LinkButton>
<cc1:ModalPopupExtender ID="lbChangeZipPriorty_ModalPopupExtender"
runat="server" CancelControlID="btnCloseProductPanel" DynamicServicePath=""
Enabled="True" PopupControlID="pnlZipPriority"
TargetControlID="lbChangeZipPriorty">
</cc1:ModalPopupExtender>
</div>
<asp:ScriptManager ID="scriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/proxy.asmx" />
</Services>
</asp:ScriptManager>
<telerik:RadGrid ID="rdScreenings" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
CssClass="ScreeningListControl" GridLines="None">
<PagerStyle NextPageText="View more locations" />
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridTemplateColumn DataField="ScreeningDate"
HeaderText="Screening date" UniqueName="TemplateColumn1">
<ItemTemplate>
<asp:Label ID="lblScreeningDate" runat="server"
Text='<%#String.Format("{0:D}", Eval("ScreeningDate")) %>'></asp:Label>
<br />
<asp:ImageButton ID="ibShareWithAFriend" runat="server"
ImageUrl="~/images/email_go.gif" />
<asp:LinkButton ID="lbSharewithAFriend" runat="server">Share with a friend</asp:LinkButton>
</ItemTemplate>
<HeaderStyle CssClass="ScreeningListHeader" />
<ItemStyle CssClass="ScreeningDate" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Screening location"
UniqueName="TemplateColumn2">
<ItemTemplate>
<asp:Label ID="lblSiteName" runat="server" Text='<%# Eval("SiteName") %>'></asp:Label>
<br />
<asp:Label ID="lblSiteCity" runat="server" Text='<%# Eval("City") %>'></asp:Label>
<asp:Label ID="lblSiteState" runat="server"
Text='<%# Eval("StateName") %>'></asp:Label>
,
<asp:Label ID="lblSiteZip" runat="server" Text='<%# Eval("ZipCode") %>'></asp:Label>
<br />
<asp:Image ID="imgMap" runat="server" ImageUrl="~/images/map.gif" />
<asp:HyperLink ID="hlViewMap" runat="server" Target="_blank" NavigateUrl='<%#GenerateGoogleMapLink(Convert.ToString(Eval("Address1")),Convert.ToString(Eval("City")),Convert.ToString(Eval("State")),Convert.ToString(Eval("ZipCode"))) %>'>View Map</asp:HyperLink>
</ItemTemplate>
<HeaderStyle CssClass="ScreeningListHeader" />
<ItemStyle CssClass="ScreeningLocation" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="Distance" HeaderText="Distance"
UniqueName="column" DataFormatString="{0} miles">
<HeaderStyle CssClass="ScreeningListHeader" />
<ItemStyle CssClass="Distance" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Available check in times"
UniqueName="TemplateColumn3">
<ItemTemplate>
<asp:Label ID="lblAvailable" runat="server" Text='<%#AvailableOpeningsText(Convert.ToInt32(Eval("OpenAppointmentCount"))) %>'></asp:Label>
</ItemTemplate>
<HeaderStyle CssClass="ScreeningListHeader" />
<ItemStyle CssClass="AvailableTimes" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="TemplateColumn">
<HeaderStyle CssClass="ScreeningListHeader" />
<ItemStyle CssClass="SelectScreening" />
<ItemTemplate>
<asp:HyperLink ID="hlSelectScreening" runat="server" ImageUrl='<%#SetSelectButtonImage( Convert.ToInt32(Eval("OpenAppointmentCount")) ) %>' NavigateUrl='<%#BuildRoutingHyperlink(Convert.ToInt32(Eval("ScreeningID")),Convert.ToInt32(Eval("Routing")), Convert.ToDateTime(Eval("ScreeningDate")),Convert.ToString(Eval("SiteName")), Convert.ToInt32(Eval("OpenAppointmentCount"))) %>' ></asp:HyperLink>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<ClientEvents OnCommand="RadGrid_OnCommand" />
</ClientSettings>
</telerik:RadGrid>
</div>
<div id="ControlsFooter">
<asp:Panel ID="pnlZipPriority" runat="server" CssClass="ModalTable_Panel">
<table border="0" cellpadding="0" cellspacing="0" class="ModalTable">
<tr>
<td width="11" height="11"><img src="images/corn-lt.gif" width="11" height="11" /></td>
<td height="11" colspan="2" background="images/tab-t.gif"></td>
<td width="11" height="11"><img src="images/corn-rt.gif" width="11" height="11" /></td>
</tr>
<tr>
<td width="11" background="images/tab-l.gif"> </td>
<td colspan="2" align="center"><table border="0" cellspacing="5" cellpadding="0">
<tr>
<td align="left" valign="middle" class="hd1">Enter US Zip Code</td>
<td align="left" valign="middle">
<asp:TextBox ID="txtZCode" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="rfvZipCode" runat="server" ControlToValidate="txtZCode"><asp:Image ID="imgReqZipCode" runat="server" ImageUrl="~/images/required.gif" />
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left" valign="top">Optional priority code<br />
<a href="#" class="notes">(What’s this?)</a><br /></td>
<td align="left" valign="top">
<asp:TextBox ID="txtPriorityCode" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" valign="middle"><a href="#"></a>
</td>
<td align="left" valign="middle">
<asp:ImageButton ID="ibGoZipUpdate" runat="server"
ImageUrl="~/images/bt-go.gif" onclick="ibGoZipUpdate_Click" />
<asp:Button ID="btnCloseProductPanel" runat="server" Text="Close" OnClientClick="changeZipCode();" />
</td>
</tr>
</table></td>
<td width="11" background="images/tab-r.gif"> </td>
</tr>
<tr>
<td width="11" height="11"><img src="images/corn-lb.gif" width="11" height="11" /></td>
<td height="11" colspan="2" background="images/tab-b.gif"></td>
<td width="11" height="11"><img src="images/corn-rb.gif" width="11" height="11" /></td>
</tr>
</table>
</asp:Panel>
<asp:Label ID="lblLastVisted" runat="server" Visible="false"></asp:Label><asp:Label ID="lblParticipantGuid" runat="server" Visible="False"></asp:Label>
<asp:ObjectDataSource ID="odsZipSearch" runat="server"
SelectMethod="GetScreeningsListByZipCode" TypeName="CStarECom.ECommerce">
<SelectParameters>
<asp:ControlParameter ControlID="lblZipCode" Name="zipCode" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="refreshData();" />
</div>
</asp:Content>
The WebSerice that is called:
This is in a asmx that is inside of the web site and it call the orginal existing web service that sits on an 'external server' (same domain different ports)
//GetProductListByPackage(packageID);
[WebMethod]
public XmlDocument GetProductListByPackage(int packageID)
{
XmlDocument _xmlDoc = new XmlDocument();
////if (zipcode != null && zipcode != "")
////{
CStarECom.ECommerce webService = new CStarECom.ECommerce();
DataTable dt = webService.GetProductListByPackageID(packageID);
// This is the final document
//XmlDocument Data = new XmlDocument();
// Create a string writer that will write the Xml to a string
StringWriter stringWriter = new StringWriter();
// The Xml Text writer acts as a bridge between the xml stream and the text stream
XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
// Now take the Dataset and extract the Xml from it, it will write to the string writer
dt.WriteXml(xmlTextWriter, XmlWriteMode.IgnoreSchema);
// Write the Xml out to a string
string contentAsXmlString = stringWriter.ToString();
// load the string of Xml into the document
_xmlDoc.LoadXml(contentAsXmlString);
//
//xmlDoc.LoadXml(dt.WriteXml();
//dt.WriteXml(_xmlDoc);
//return CStarCalls.GetScreeningsByZipCode(zipcode);
return _xmlDoc;
////}
////else
////{
//// return null;
////}
}
Thank you for the additional code.
I have attached a sample project implementing the desired scenario with getting the master table view successfully.
I hope that it will help you. If you need further assistance please send us the whole project.
Best wishes,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

What exactly am i suppose to use from that code?
-You added a RadScriptManager but removed the ScriptManager that actually references the WebService i am calling
-The javascript is exactly the same
-Removed references to datafield from RadGrid (nothing to show)
Do i need to use the RadScriptManager?
-If so, why does it error when i try and add the reference to the Proxy.asmx (web.config reference error)
I appreciate the help but i do not understand what i am suppose to learn from this
Indeed it is your choice to use ScriptManager or RadScriptManager. I sent you the sample project to show you that the way you access the MasterTableView is correct.
Once again, I kindly ask you to send me the whole project so that I can debug it, because otherwise I am unable to replicate your issue. I recommend you to open a support ticket where you would be able to attach files. Please send us your database as well.
All the best,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

this my code
scriptmanager
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> |
<Services> |
<asp:ServiceReference Path="~/WsDatosAO.svc" /> |
</Services> |
</asp:ScriptManager> |
my grid
<telerik:RadGrid ID="GridViewExcel" runat="server" AutoGenerateColumns="true"> |
</telerik:RadGrid> |
my javascript
function RefrescarGrid(fileName) { |
WsDatosAO.GetData(fileName, updateGrid); |
} |
function updateGrid(result) { |
var tableView = $find("<%= GridViewExcel.ClientID %>").get_masterTableView(); |
tableView.set_dataSource(result); |
tableView.dataBind(); |
} |
finaly my web service method
|
|||||||||||||||||||
public DataSet GetData(string fileName) | |||||||||||||||||||
{ | |||||||||||||||||||
OleDbDataAdapter objDataAdapter = new OleDbDataAdapter(); | |||||||||||||||||||
objDataAdapter.SelectCommand = ExcelConnection(fileName.Replace("|","\\")); | |||||||||||||||||||
DataSet objDataSet = new DataSet(); | |||||||||||||||||||
objDataAdapter.Fill(objDataSet); | |||||||||||||||||||
return objDataSet; | |||||||||||||||||||
} | |||||||||||||||||||
protected OleDbCommand ExcelConnection(string fileName) | |||||||||||||||||||
{ | |||||||||||||||||||
string xConnStr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;", fileName); | |||||||||||||||||||
OleDbConnection objXConn = new OleDbConnection(xConnStr); | |||||||||||||||||||
objXConn.Open(); | |||||||||||||||||||
OleDbCommand objCommand = new OleDbCommand("SELECT * FROM [Members$]", objXConn); | |||||||||||||||||||
return objCommand; | |||||||||||||||||||
} |
Your code snippets seem fine to me, so I suggest that you open a formal support ticket and attach a small working project replicating your issue which we can debug locally.
Best wishes,
Mira
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

I have the same problem.
Thanks

Are you attempting to access the RadGrid's MasterTableView in JavaScript on the client-side when you get the error?
Can you please post your code so we can see what you're doing? That would help to diagnose the cause.
Cheers!

I just had the same problem.
Seems you should add these pieces of code even if you are not planning on using it (see from the telerik examples where this code belong):
function RadGrid_OnCommand(sender, args) {
//intentionally left blank
}
<ClientSettings>
<ClientEvents OnCommand="RadGrid_OnCommand" />
</ClientSettings>
Good Luck!!
PieterDevill

I understand why Pieter's solution works so I'm not going to complain about the RadGrid implementation. However, this error is all of the forum post, so it would nice for the Telerik folks to update the get_masterTableView() help to include this information. I have submitted feedback to them with the suggestion.
Thanks again, Pieter. Gold star!
