Reputation: 6768
how can i pass the selected value of dropdown list to user control .aspx
<select id="DropDownList2">
<option value="product1">Police Schemes1</option>
<option value="product2">Police Schemes2</option>
<option value="product3">Police Schemes3</option>
</select>
.ascx
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//string selectedvalue = "";
}
}
Any assistance or suggestion will be apreciated
Upvotes: 1
Views: 1803
Reputation: 148110
Add attribute runat="server" and get it Like this.
In html put attribute runat="server"
<select id="DropDownList2" runat="server">
<option value="product1">Police Schemes1</option>
<option value="product2">Police Schemes2</option>
<option value="product3">Police Schemes3</option>
</select>
In code behind put this
string selectedvalue = DropDownList2.Value;
Upvotes: 1