WebGrid provides method to trigger exporting from client-side.
In this topic, you will learn how to trigger data export in Client-Side programmatically.
To trigger data export in Client-Side
- Open WebGrid.NET Designer and select Allow Exporting.
- Place a html button in the WebForm and named it as Button1.
- Put the following code under Button1_onclick() client-side event.
Javascript Copy Code function Button1_onclick() { // retrieves WebGrid's object var WebGrid1 = ISGetObject("WebGrid1"); WebGrid1.ExportGrid("", "EXCEL", "PORTRAIT"); // export grid to excel }
- Invoke Button1_onclick from the html button like following:
<input id="Button1" type="button" value="Export From Client" language="javascript" onclick="return Button1_onclick()" />
- Run the project.
Other Resources
Walkthrough Topics
How-to Topics