I have a Gridview with a templated field that contains a dropdownlist. I want to disable that dropdown list if the selected value is equal to a specific value.
I have tried several variations of getting to this control but have failed in frustration. Need help. My assumption is that the templated row is not available until you go into editing mode, so the following code example assumes that I have to have my code in the RowEditing Event Handler. here is my code so far:
protected void GV1_RowEditing(object o, GridViewEditEventArgs e)
DropDownList ddlChangeRole2 = GridView1.Rows[e.NewEditIndex].FindControl("DropDownList2").???? // here is where I am running into problem. On databoud field this method worked fine. on templated field it does not
if (ddlChangeRole.SelectedValue == "Owner")
ddlChangeRole.Enabled = false;
I understand how to do this in .net 1.1 but am new to 2.0 so any help would be appreciated.