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

how to pass dataset from webservice to radgrid using javascript

1 Answer 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
feroz minnadad
Top achievements
Rank 1
feroz minnadad asked on 04 Mar 2010, 09:32 PM
Hi,

I m using radgrid for my application.

and i need to pass a dataset or datatable from webservice to bind radgrid using javascript.

i have worked with your sample also and i have used following code snippet,

In webservice

 

public DataSet HelloWorld()

 

{

 

 

 

DataTable datatable = (DataTable)Session["oInstallationInfo"];

 

 

DataSet ds = new DataSet();

 

 

 ds.Tables.Add(datatable);

 

return ds;

 

}

and
in aspx page

 

function

 

ReceiveServerData(rValue)

 

{

 

 

  

 

xtenzasolutions.WebService1.HelloWorld(updateGrid,OnError);

alert(rValue);

 

 

}

 

function

 

OnError(result)

 

{

alert(

"Error : "+result.get_message());

 

}

 

 

 

 

 

function updateGrid(result,userContext)

 

{

 

debugger;

 

alert(result);

 

var tableview= $find("<%= rgDetails.ClientID %>").get_masterTableView();

 

tableview.set_dataSource(result);

tableview.dataBind();

}

I m getting the error 'Circular Reference was detected'. Please find the error page with this message.

Please give any suggestions.

Thanks in advance.

Regards,
Feroz

1 Answer, 1 is accepted

Sort by
0
Accepted
BaiH
Top achievements
Rank 1
answered on 09 Mar 2010, 03:29 PM
The built-in MS JavaScriptSerializer actually doesn't support serializing DataSet/DataTable nor DataRows by default. You may check the following blog post if you want to get your hand dirty:
DataTable JSON Serialization in JSON.NET and JavaScriptSerializer

or simply change your method to return some IEnumerable of a custom object.

--BH



Tags
Grid
Asked by
feroz minnadad
Top achievements
Rank 1
Answers by
BaiH
Top achievements
Rank 1
Share this question
or