Gridview/Formview - ASP.Net Page Lifecycle
Posted on 2006-11-01
I have a page with a label (label1) in a formview( FormView1) and a label (label2) in a gridview(MyGridView).
The gridview label gets its value from the formview ( see code below) on the page_load event.
everything works fine on page_load except the gridview label shows the previous page's value. How do I ensure the formview is updated first and the gridview then reads the updated formview label?
protected void Page_Load(object sender, EventArgs e)
FormViewRow row = FormView1.Row
Label formlbl = (Label)row.FindControl("label1")
GridViewRow grdrow = MyGridView.HeaderRow;
Label grdlbl = (Label)grdrow.FindControl("label2")
grdlbl.text = formlbl.text