I am tring to create n number of dropdown list.each have the same content. In this way i am able to create the dropdownlist but when the post back happens on the page the dropdownlist vanishes.
so what should be done in this case. i don't now VB so if you could please explain in c# it will be very kind of u.
[code=cpp]
DropDownList[] t = new DropDownList[12];
or (int i = 1; i <= n; i++)
{
t[i].ID = "C" + Convert.ToStrin g (i);
t[i].DataTextField = "cropName";
t[i].DataValueField = "cropId";
t[1].Visible = true;
t[i].DataSource = ds;
t[i].DataBind();
t[i].Items.Insert(0 , "--Select--");
Literal l1 = new Literal();
l1.Text = "<br/>";
PlaceHolder1.Co ntrols.Add(t[i]);
PlaceHolder1.Co ntrols.Add(l1);
}[/code]
so what should be done in this case. i don't now VB so if you could please explain in c# it will be very kind of u.
[code=cpp]
DropDownList[] t = new DropDownList[12];
or (int i = 1; i <= n; i++)
{
t[i].ID = "C" + Convert.ToStrin g (i);
t[i].DataTextField = "cropName";
t[i].DataValueField = "cropId";
t[1].Visible = true;
t[i].DataSource = ds;
t[i].DataBind();
t[i].Items.Insert(0 , "--Select--");
Literal l1 = new Literal();
l1.Text = "<br/>";
PlaceHolder1.Co ntrols.Add(t[i]);
PlaceHolder1.Co ntrols.Add(l1);
}[/code]
Comment