asp .net C# how do you set dropdownlist in page load if (!Page.IsPostBack)
Posted on 2009-04-06
Expert: I have a Formview with a dropdownlist that is loaded by the database. However when the page is first loaded I want to set the dropdownlist to say "expert". I tried the following with no luck: --> could you please show me the correct way to do this?
FormView form = FindControl("expertform) as FormView;
DropDownList Ddl =
form .FindControl("mydropdown_Ddl") as DropDownList;
mydropdown_Ddl.SelectedValue = "expert";