Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

initialize dropdown formview

Avatar of Angela4eva
Angela4eva asked on
C#ASP.NET
4 Comments1 Solution584 ViewsLast Modified:
I am trying to initialize a dropdown in a formview. i put the initializing code that is adding all the month to drop down in pageload,prerender everywhere. But doesn't seem to work. Please help
<formview>
<ItemTemplate>
                  <td>
                                        <asp:DropDownList ID="ddlIssuanceMonth" runat="server"  Enabled="false"
                                            SelectedValue='<%#DataBinder.Eval(Container.DataItem,"IssuanceMonth")%>'>
                                        </asp:DropDownList>
                                    </td>
             

--codebehind

    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();
     ((DropDownList)(FVInvestigations.FindControl("ddlIssuanceMonth"))).Items.Add(list);
 }
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers