Formview dropdown help

In the below code is not working.
intelissense does not show selectedvalue, how can i populate the selected value .please help.
                                        <asp:DropDownList ID="ddlIssuanceMonth" runat="server"  Enabled="false"


    protected void FVInvestigations_PreRender(object sender, EventArgs e)
 DateTime month = Convert.ToDateTime("1/1/2000");
 for (int i = 0; i < 12; i++)
     DateTime NextMont = month.AddMonths(i);
     ListItem list = new ListItem();
     list.Text = NextMont.ToString("MMMM");
     list.Value = NextMont.Month.ToString();

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Unless you add list items, makes no sense to set selectedvalue

<asp:DropDownList ID="ddlIssuanceMonth" runat="server"  Enabled="false"

 <asp:ListItem Text="1" Value="1"></asp:ListItem>
    <asp:ListItem Text="2" Value="2"></asp:ListItem>
    <asp:ListItem Text="3" Value="3"></asp:ListItem>

Open in new window

---->intelissense does not show selectedvalue
SelectedValue is a non-browsable property and so it won't showup in .aspx intellisense or in designer Properties windows but you can still use it. It will show up in code-behind intellisense though.

---->how can i populate the selected value.
Are you getting any errors?
One thing you need to make sure is...your are doing:
list.Value = NextMont.Month.ToString();
So make sure "IssuanceMonth" returned from DB is same string format as list.Value.
2: I think since  you are adding items to DDL in FV PreRender ... you might want to set the selectedValue of ddl in there after adding items..

((DropDownList)(FVInvestigations.FindControl("ddlIssuanceMonth"))).SelectedValue= "Month"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.