R
Robson Carvalho Machado
Dear Friends,
Using HTML we can create a DropDownList as follows
<select name="xxx">
<option value="1">Brazil
<option value="2">USA
<option value="3">Canada
</select>
How can I do this with WebControls by using CodeBehind?
I was trying the below code but could not set both value and label of each
item.
myDropDownList = New DropDownList
myDropDownList.ID = Id
myDropDownList.Items.Add("Brasil")
myDropDownList.Items.Add("USA")
myDropDownList.Items.Add("Canada")
myUnits = New System.Web.UI.WebControls.Unit(402)
myDropDownList.Width = myUnits
myDropDownList.Attributes("style") = Style
PlaceHolder1.Controls.Add(myDropDownList)
Using HTML we can create a DropDownList as follows
<select name="xxx">
<option value="1">Brazil
<option value="2">USA
<option value="3">Canada
</select>
How can I do this with WebControls by using CodeBehind?
I was trying the below code but could not set both value and label of each
item.
myDropDownList = New DropDownList
myDropDownList.ID = Id
myDropDownList.Items.Add("Brasil")
myDropDownList.Items.Add("USA")
myDropDownList.Items.Add("Canada")
myUnits = New System.Web.UI.WebControls.Unit(402)
myDropDownList.Width = myUnits
myDropDownList.Attributes("style") = Style
PlaceHolder1.Controls.Add(myDropDownList)