ASP.NET cannot change the visibility of the Formview control

I feel like it's silly, but what the hell ...

these are the two lines of methods that handle the dropdownlist event:

        resolve = (Button)FormView1.FindControl("btn_resolve");
        resolve.Visible = true;

      

He used to work with me before! Doesn't work now

+2


source to share


1 answer


you need to use Formview Databound event like



 protected void FormView1_DataBound(object sender, EventArgs e)
{
    if (FormView1.CurrentMode == FormViewMode.Edit)
    {
        btn_resolve = (Button)FormView1.FindControl("btn_resolve");
        resolve.Visible = true;
    }
}

      

+2


source







All Articles