This walkthrough will show you how to use OnButtonClick client side event.
In this topic, you will learn the basic thing on how to display the selected row's details using OnButtonClick.
To display the selected row's details using OnButtonClick
- Select WebGrid's instance and press F4.
- In Layout Settings, select ClientSideEvents, then set OnButtonClick to MyOpen.
- Write this function in OnButtonClick client side event:
JavaScript Copy Code function MyOpen() { window.open("NewPage.aspx",null,"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no"); }
- Create a new page and named it "NewPage.aspx".
- On Window onload client side events, write the following function:
JavaScript Copy Code function window::onload() { var grid = window.opener.ISGetObject("WebGrid1"); var row = grid.GetSelectedObject().ToRowObject(); var cell = row.GetCells(); Label1.innerText = cell[3].Text; Label2.innerText = cell[4].Text; }
References
OnButtonClick Property
Other Resources
Walkthrough Topics
How-to Topics