Reputation: 686
I'm getting a list of values on server side and I'm creating a dropdownlist with this:
var sb = new StringBuilder();
sb.Append("<select name=\"topics\" class=\"topicsSelect\" id=\"topicsSelect\">");
foreach (var topic in sorted){
sb.AppendFormat("<option value='{0}'>1{1}</option>", LinkManager.GetItemUrl(topic),
(topic.Fields["PageTitle"] != null && !string.IsNullOrEmpty(topic.Fields["PageTitle"].Value))
? topic.Fields["PageTitle"].Value
: topic.Name);
}
sb.Append("</select>");
litTopicList.Text = sb.ToString();
But now I'm trying to get the selected value onclick and I can't access this information? Am I missing something?
Thanks in advance.
Cheers
Upvotes: 0
Views: 944
Reputation: 7
Can you check the example here?
http://learn.jquery.com/using-jquery-core/faq/how-do-i-get-the-text-value-of-a-selected-option/
Upvotes: 0
Reputation: 68400
Try with
string topicsSelect = Page.Request.Form["topicsSelect"];
or just
string topicsSelect = Page.Request["topicsSelect"];
Upvotes: 1