开发者

ASP.NET [Need an event after page load (After GridView renew data) ]

开发者 https://www.devze.com 2022-12-17 14:29 出处:网络
I renew parameters of my DataSource for GridView on Button and loads 开发者_如何学Pythonevent Page_Load()

I renew parameters of my DataSource for GridView on Button and loads 开发者_如何学Pythonevent Page_Load() and After it (or with it) GridView renews itself.

I need to rename Header rows but there is no event after Page Load.

more information about details here :

[On Button Click] I change DataSource and Bind it (SqlDataSource1.DataBind(); ) Then sure Page gone to Refresh elements.

[On Page_Load] GridView is changing data, but if I can't change Headers there because it's looking like loads after this function :(

[one more Button] I can add new button with a function - rename headers and it works correct everytime

    protected void Button2_Click(object sender, EventArgs e)
{
    // Stack overflow
    DataRow T;
    if (go)
        if (GridView2.HeaderRow.Cells.Count != 0)
            for (int i = 0; i < SQF.SQF.Permission.Rows.Count; i++)
            {
                T = SQF.SQF.Permission.Rows[i];
                GridView2.HeaderRow.Cells[i].Text = (string)T["Caption1"];
                WebMsgBox.Show((string)T["Caption1"]);
            }
}

Trouble : I no need one more button for it, I need to rename header rows after I click button to change Data but I have no idea where I can do it.

thank you.


Well you could use Gridview DataBound event, like that:

<asp:GridView runat="server" ID="SomeID" OnDataBound="GridVIew_OnDataBound" ... />

The DataBound event occurs right after the databinding process for that particular control has completed.


After Page_Load there is an event Page.PreRender. Maybe it will suit you.

EDIT. All events of your components, such as GridView, are fired between Page.Load and Page.PreRender. Consider using RowDataBound and RowUpdated events.

0

精彩评论

暂无评论...
验证码 换一张
取 消