Shankarooni
Shankarooni

Reputation: 207

ASP.NET Can not Change Visibility of a Formview control

I feel this is stupid, but what the hell...

this is two lines of a methods that handles a dropdownlist event:

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

It used to work with me earlier! Not working now

Upvotes: 2

Views: 2257

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

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;
    }
}

Upvotes: 2

Related Questions