1.aspx page
A.) asp:dropdown ...onchange="javascriptfunctionname">
B.) <script>
Javascriptfunctionname
{
Getting dropdown selected values
}
</script>
C.) Problem Here:
How to pass drop down selected values in any c# method
D.) C# code
Public methodname
{
// NEED TO COMBO VALUES HERE ON CALLING ONCHANGE FUNCTION
}
Please help to guide.Its very important and is to complete urgently.Thanks
You may use post back on the control, and everytime onchange hit, it will do postback to server and you may get your value on the server side.
html
<asp:dropdownlist runat="server" autopostback="true" onselectedindexchanged="ddlTest_SelectedIndexChanged" id="ddlTest"> </asp:dropdownlist>
code behind
protected void ddlTest_SelectedIndexChanged(object sender, EventArgs e)
{
string selectedText = ddlTest.SelectedItem.Text;
string selectedValue = ddlTest.SelectedItem.Value;
//--- Show results in page.
Response.Write("Selected Text is " + selectedText + " and selected value is :" + selectedValue);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.