简体   繁体   中英

Click event on Page_Prerender in C#

In my application there is a grid which gets loaded once the user click on row which has some data, but now my requirement is like I want to load the grid at the time when page gets loaded, so for that I just want to call the Click event to happen automatically at the Page_Prerender itself. Can anyone please help me out with the solution.

Say you have a grid view like this.

<GridView ID="gvChildGrid" runat="server" />

You can easily data bind it in Page_PreRender event with

protected override void OnPreRender(EventArgs args)
{
    gvChildGrid.DataSource = yourdatasource;
    gvChildGrid.DataBind();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM