Can someone please provide me with a sample demonstrating how to bind to a WebDataGrid client side NOT using a datasource like in the samples browser? I would like to make a web service call using JSON and bind the data client side, but the only example I can find is the one in the samples browser connecting to a database.
Hello bpg730,
If you use 10.3 version of the toolset there are sample showing this. But keep in mind that this feature is still CTP:
Client side binding
Hope this helps
I have been looking at this example, but it appears as though it is calling methods not available in 10.3. Specifically, I am getting an error on the grid._applyClientBinding() line. Is there an updated version or hotfix that has these methods for the WebDataGrid?
Hey Dave,
I came up with a solution using jquery templates. I can not use postbacks due to the site requirements.
If interested, please feel free to email me at Dave@TEUConsulting.com ,
Will
Hi DaveI am also getting same type of issue on ._applyClientBinding()
Did you get any solution, if yes plz suggest how to resolve this
Hey Shyam,
Will and I talked about a solution a few weeks ago but lost contact for a bit due to working so damned much. Nevertheless, I can tell that Will got his solution working in .NET 4.0, but I was not able to get it working in .NET 3.5 as I don't think this feature is supported in that version. I need to reconnect with Will to see if his solution will work for me.
In the mean time can you fill me in on your specific situation? Like .NET version and Service Type, such as Web Service or WCF etc.
ThanksDave
Hi DaveI am using .NET 4.0, Infragistics4.Web.v10.3, Version=10.3.20103.2105 and I am working in MVC.
I have a webdropdown on change of webdropdown on clientside (<ClientEvents SelectionChanged="wcProject_SelectionChanged" />) I am able to fetch data using JSON , JSONResult, now I want to bind that data to Webdatagrid like -
//to bind webdatagrid var myGrid = $find('<%=grdProjectDirectory.ClientID %>'); //document.getElementById(''); var dataSource = myGrid._get_dataSource(); var arr = this.Inbox[0].lstProject; if (!myGrid.tableTemplate) myGrid.tableTemplate = myGrid._elements.dataTbl.lastChild.cloneNode(true); for (var i = 0; i < arr.length; i++) { dataSource.push(this.Inbox[0].lstProject[i]); } $(myGrid._elements.dataTbl.lastChild).empty(); myGrid._set_dataSource(dataSource); myGrid._pi.show(myGrid); myGrid._applyClientBinding(); myGrid._pi.hide(myGrid);
Here on _applyClientBinding(); getting an error Object does not support this property or method
<script src="../../Scripts/jquery-1.6.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.tmpl.js" type="text/javascript"></script> <script src="../../Scripts/jquery.tmpl.min.js" type="text/javascript"></script> <script src="../../Scripts/jquery.tmplPlus.js" type="text/javascript"></script> <script src="../../Scripts/jquery.tmplPlus.min.js" type="text/javascript"></script>
Suggest me where I am wrong.
Regards
Shyam
Hi Shyam,
I don't work for Infragistics but would like to try helping you out, at the same time fixing my own issue. I might have the time during the backend of this week but from what I can see in your code example all looks good. Are you seeing blank rows of data or not rows at all?
This is what I tried so it might help you. It DOES NOT use dataGrid._applyClientBinding(); because jQuery would always through that same error to are seeing. But this returns blank rows for me.<%@ Register Assembly="Infragistics35.Web.v10.3, Version=10.3.20103.2120, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="ig" %>
<
script type="text/javascript" src="JSON/json2.js"></script><script type="text/javascript" src="Scripts/jquery-1.4.3.js"></script><script type="text/javascript" src="Scripts/jquery.tmpl.js"></script>
function onSuccessOfGetAccountHistory(result) { var dialog = $find("WebDialogWindowShowDetails"); var dataGrid = $find("WebDialogWindowShowDetails_tmpl_WebDataGridShowDetails"); //create a datasource var dataSource = dataGrid._get_dataSource(); var newData = eval(result); //Empty the grid $(dataGrid._elements.dataTbl.lastChild).empty();
//Populate the dataGrid dataGrid._pi.show(dataGrid);
for (var i = 0; i < newData.length; i++) { //dataSource.push(newData[i]); $(dataGrid.tableTemplate).data(newData[i]).appendTo(dataGrid._elements.dataTbl.lastChild); } dataGrid._pi.hide(dataGrid);
//Show the results dialog.set_windowState($IG.DialogWindowState.Normal); }
Let me know if this helps at all...Dave
Looks like we are in the same boat so I will play around with it some more this week and hopfully an Infragistics developer will see this posting before too long and help us out.
Dave
Hi Dave
I tried as you suggested but still not getting var myGrid1 = $find("MainContent_pnlProjectDirectory_grdProjectDirectory"); //create a datasource var dataSource = myGrid1._get_dataSource(); var newData = eval(this.Data.lstProjectDir); //Empty the grid $(myGrid1._elements.dataTbl.lastChild).empty(); //Populate the dataGrid myGrid1._pi.show(myGrid1); for (var i = 0; i < newData.length; i++) { //dataSource.push(newData[i]); $(myGrid1.tableTemplate).data(newData[i]).appendTo(myGrid1._elements.dataTbl.lastChild); } //myGrid1._set_dataSource(dataSource); myGrid1._pi.hide(myGrid1);
Now result is coming as but data is not displayed
<tr><td style="width: 0px;">${Id}</td><td style="width: 200px;">${Name}</td><td style="width: 200px;">${DisplayName}</td><td style="width: 120px;">${Phone}</td>
<td style="width: 120px;">${Fax}</td><td style="width: 120px;">${BusinessEmail}</td></tr>But one more point when I am pushing data to datasource and applyingClientBinding it is giving errorfor (var i = 0; i < newData.length; i++) { dataSource.push(newData[i]); $(myGrid1.tableTemplate).data(newData[i]).appendTo(myGrid1._elements.dataTbl.lastChild); } myGrid1._set_dataSource(dataSource); myGrid1._applyClientBinding(); myGrid1._pi.hide(myGrid1);When not pushing data to datasource it is not giving any error of object does not support