TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jude Lobo
NA
2
765
Can't get value for DropDownList
Dec 17 2017 1:59 AM
I'm trying to get value of DropDownList in the OnPreInit event, here's the code for it:
protected override void OnPreInit(EventArgs e)
{
if(Request.Form["DropDownList1"]!=null)
{
var theme = Request.Form["DropDownList1"];
Page.Theme = theme;
}
base.OnPreInit(e);
}
But on debugging it returns null every time, here's the code for the dropdownlist:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="about-content" style="height:600px">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>Theme1</asp:ListItem>
<asp:ListItem>Theme2</asp:ListItem>
</asp:DropDownList>
</div>
</asp:Content>
Also I'm doing this inside a masterpages contentplaceholder, if that helps.
Reply
Answers (
1
)
ASP.NET AJAX MVC - Calling Controller Method from View
Multiple razor view on one view