How to update a gridview from a page method from code?

How to update gridview on aspx page using web method?

Here is my code.

[WebMethod]
public static string GetDate()
{

    return DateTime.Now.ToString();
}

I cannot use the findcontrol or "this" methods, so I need help.

+3
source share
1 answer

You can dynamically / programmatically create a GridView control. Then in your WebMethod, you can call the RenderControl () method to retrieve the HTML content in the processed GridView control. Return this content from WebMethod and include the JavaScript callback function in the HTML content of your innerHTML placeholder.

- . , WebMethod , ( ), , JSON. - javascript templates . GridView, .

+4

Source: https://habr.com/ru/post/1698040/


All Articles