How to update an datagrid with webmethods

I choose the method to update my data every second with a javascript PageMethod and WebMethod.

With much returns via an object I can set hunderts of labels if it is naeccasery.

The time for 2 completedatabase-querys is unter 200 Milliseconds and the Post-Weight is wunderfull low!

But how I can databind my gridview in a webmethod?

Is there a way to bind it in JavaScript of how can I access it with a static method?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can absolutely use AJAX and web services to display tabular data (grids) in your ASP.NET applications. These StackOverflow questions offer a good introduction to several different options:

However, you cannot literally databind GridView or DataGrid controls in javascript functions. The grid controls are server-side objects, deeply integrated into the ASP.NET page lifecycle.

ASP.NET controls only exist inside Page instances – and no page instance is created during the execution of static WebMethods. For a great explanation of this, see Why do ASP.NET AJAX page methods have to be static?


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x