I have 2 dropdownlist on a page. They have ViewState = true. After I
submit to the page, the selection in the DropDownList is lost. I set a
break in the Page_Load event to make sure that I wasn't re-binding them
somehow... I'm not. So shouldn't they maintain their selection?
Anything you can think of to check?
Thanks-
Steve 8 5200
DropDownList must remember their selection!
I have this example and it works fine...
This page when selected value change make a postback.
Selected value in DropDownList never change.
[C# - CodeBehind]
if (!IsPostBack)
{
ArrayList al = new ArrayList();
al.Add("aa");
al.Add("bb");
al.Add("cc");
DropDownList1.DataSource = al;
DropDownList1.DataBind();
al.Add("dd");
DropDownList2.DataSource = al;
DropDownList2.DataBind();
}
[ASPX page]
<asp:DropDownList AutoPostBack="True" id="DropDownList1"
runat="server"></asp:DropDownList>
<asp:DropDownList AutoPostBack="True" id="DropDownList2"
runat="server"></asp:DropDownList>
Brun
"sklett" <as**@fkd.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... I have 2 dropdownlist on a page. They have ViewState = true. After I submit to the page, the selection in the DropDownList is lost. I set a break in the Page_Load event to make sure that I wasn't re-binding them somehow... I'm not. So shouldn't they maintain their selection?
Anything you can think of to check?
Thanks- Steve
DropDownList must remember their selection!
I have this example and it works fine...
This page when selected value change make a postback.
Selected value in DropDownList never change.
[C# - CodeBehind]
if (!IsPostBack)
{
ArrayList al = new ArrayList();
al.Add("aa");
al.Add("bb");
al.Add("cc");
DropDownList1.DataSource = al;
DropDownList1.DataBind();
al.Add("dd");
DropDownList2.DataSource = al;
DropDownList2.DataBind();
}
[ASPX page]
<asp:DropDownList AutoPostBack="True" id="DropDownList1"
runat="server"></asp:DropDownList>
<asp:DropDownList AutoPostBack="True" id="DropDownList2"
runat="server"></asp:DropDownList>
Brun
"sklett" <as**@fkd.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... I have 2 dropdownlist on a page. They have ViewState = true. After I submit to the page, the selection in the DropDownList is lost. I set a break in the Page_Load event to make sure that I wasn't re-binding them somehow... I'm not. So shouldn't they maintain their selection?
Anything you can think of to check?
Thanks- Steve
That is really odd, I have 2-3 pages that all have the opposite behavior.
If I have a dropdownlist with 3 items, a, b, and c
Auto postback set to true
if I select 'b', when the page is rendered after the post back, 'a' is
selected.
I don't know what to do differently...
Thanks for the response though, looks like I have gremlins somewhere ;(
"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:5B*********************@news3.tin.it... DropDownList must remember their selection! I have this example and it works fine... This page when selected value change make a postback. Selected value in DropDownList never change.
[C# - CodeBehind] if (!IsPostBack) { ArrayList al = new ArrayList(); al.Add("aa"); al.Add("bb"); al.Add("cc"); DropDownList1.DataSource = al; DropDownList1.DataBind();
al.Add("dd"); DropDownList2.DataSource = al; DropDownList2.DataBind(); }
[ASPX page] <asp:DropDownList AutoPostBack="True" id="DropDownList1" runat="server"></asp:DropDownList> <asp:DropDownList AutoPostBack="True" id="DropDownList2" runat="server"></asp:DropDownList>
Brun
"sklett" <as**@fkd.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... I have 2 dropdownlist on a page. They have ViewState = true. After I submit to the page, the selection in the DropDownList is lost. I set a break in the Page_Load event to make sure that I wasn't re-binding them somehow... I'm not. So shouldn't they maintain their selection?
Anything you can think of to check?
Thanks- Steve
That is really odd, I have 2-3 pages that all have the opposite behavior.
If I have a dropdownlist with 3 items, a, b, and c
Auto postback set to true
if I select 'b', when the page is rendered after the post back, 'a' is
selected.
I don't know what to do differently...
Thanks for the response though, looks like I have gremlins somewhere ;(
"Bruno Sirianni" <br***********@virgilio.it> wrote in message
news:5B*********************@news3.tin.it... DropDownList must remember their selection! I have this example and it works fine... This page when selected value change make a postback. Selected value in DropDownList never change.
[C# - CodeBehind] if (!IsPostBack) { ArrayList al = new ArrayList(); al.Add("aa"); al.Add("bb"); al.Add("cc"); DropDownList1.DataSource = al; DropDownList1.DataBind();
al.Add("dd"); DropDownList2.DataSource = al; DropDownList2.DataBind(); }
[ASPX page] <asp:DropDownList AutoPostBack="True" id="DropDownList1" runat="server"></asp:DropDownList> <asp:DropDownList AutoPostBack="True" id="DropDownList2" runat="server"></asp:DropDownList>
Brun
"sklett" <as**@fkd.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... I have 2 dropdownlist on a page. They have ViewState = true. After I submit to the page, the selection in the DropDownList is lost. I set a break in the Page_Load event to make sure that I wasn't re-binding them somehow... I'm not. So shouldn't they maintain their selection?
Anything you can think of to check?
Thanks- Steve
I got stumped for awhile on a similar situation when
I set the item values to something other than the item text.
So for example if the resulting html looked like this:
<option value="2">Abel</option>
<option value="3">Baker</option>
<option value="2">Charlie</option>
and I selected 'Charlie', when the form posted back
the first item with the selected value (2 in this case)
would display, so 'Abel' would be displayed.
HTH,
Jim
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I got stumped for awhile on a similar situation when
I set the item values to something other than the item text.
So for example if the resulting html looked like this:
<option value="2">Abel</option>
<option value="3">Baker</option>
<option value="2">Charlie</option>
and I selected 'Charlie', when the form posted back
the first item with the selected value (2 in this case)
would display, so 'Abel' would be displayed.
HTH,
Jim
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jim,
Yeah, that would be a fun one to find ;)
however, that is not the case for me. I set a breakpoint in the page_load
to check what the dropdown list's selected index was and it was correct IE:
if I had selected the 3rd item before postback, the SelectedIndex value was
2
but once the page is rendered... it's back to selecting the first item.
so strange.
Thanks for sharing your situation though, will come in handy some day!
"Jim Corey" <jc****@nospamcharter.net> wrote in message
news:OL**************@TK2MSFTNGP12.phx.gbl... I got stumped for awhile on a similar situation when I set the item values to something other than the item text.
So for example if the resulting html looked like this: <option value="2">Abel</option> <option value="3">Baker</option> <option value="2">Charlie</option>
and I selected 'Charlie', when the form posted back the first item with the selected value (2 in this case) would display, so 'Abel' would be displayed.
HTH, Jim
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
Jim,
Yeah, that would be a fun one to find ;)
however, that is not the case for me. I set a breakpoint in the page_load
to check what the dropdown list's selected index was and it was correct IE:
if I had selected the 3rd item before postback, the SelectedIndex value was
2
but once the page is rendered... it's back to selecting the first item.
so strange.
Thanks for sharing your situation though, will come in handy some day!
"Jim Corey" <jc****@nospamcharter.net> wrote in message
news:OL**************@TK2MSFTNGP12.phx.gbl... I got stumped for awhile on a similar situation when I set the item values to something other than the item text.
So for example if the resulting html looked like this: <option value="2">Abel</option> <option value="3">Baker</option> <option value="2">Charlie</option>
and I selected 'Charlie', when the form posted back the first item with the selected value (2 in this case) would display, so 'Abel' would be displayed.
HTH, Jim
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DotNetJunky |
last post by:
I have built a control that runs an on-line help system. Depending on the
category you selected via dropdownlist, it goes out and gets the child
subcategories, and if there are any, adds a new...
|
by: Robin Bonin |
last post by:
In my user contol I am creating a set of dropdownlists.
Each list is created based on input from the other lists.
The problem I am having is setting the selected index on
the lists.
If someone...
|
by: xu |
last post by:
Thanks!
|
by: sklett |
last post by:
I have 2 dropdownlist on a page. They have ViewState = true. After I
submit to the page, the selection in the DropDownList is lost. I set a
break in the Page_Load event to make sure that I...
|
by: Phuff |
last post by:
Thanks in advance! I'm trying to maintain a dl list's selected index
on postback. What I'm doing is when a person selects an item from the
drop down list I select a date in a calendar control and...
|
by: AG |
last post by:
Hi,
ASP.NET 2.0 web app
I have a GridView utilizing template columns and bound to an
objectdatasource.
In the edit template of one column there is a dropdownlist bound to another...
|
by: MaryamSh |
last post by:
Hi,
I am creating a Dynamic Search in my application.
I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove)
By pressing Add button...
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I...
|
by: stevem2112 |
last post by:
I have a datagrid with 2 Template columns. One column has
DropDownLists and the other has Textboxes. I bind each DDL in the
ItemCreated event. This datagrid is inside a UserControl that is
inside...
|
by: shashi shekhar singh |
last post by:
Respected Sir,
I have to create multiple dynamic dropdownlist boxes and add items dynamically in <asp:table> server control but problem occurs , i.e. except of fist dropdown list no dropdownlist...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |