I have following simple code:
<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"testForm.aspx.cs\" Inherits=\"Orbs.testForm\" %>
I solved the problem myself,
I read somewhere that turning off the ViewStateMode
will cause DropDownList
not work properly. In my web application I had to turn off ViewStateMode
to achieve some global task and turn it on case by case.
Somehow turning on ViewStateMode
on DropDownList
is not working, I even tried turning on ViewStateMode
for page and master page but still DropDownList
didn't work. it only worked when I turned on ViewStateMode
in web.config
.
As turning on ViewStateMode
in web.config
is not an option, I found and alternate solution. I'm including it here hoping it help someone.
HiddenField
to your form. Page_Load
compare value of HiddenField
with Request.Forms[DropDownList1.UniqueID]
SelectedIndexChanged
manually HiddenField
to value of Request.Forms[DropDownList1.UniqueID]
.