473,387 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dropdown list not retaining selected value using Ajax TabControl

Hello, Can someone help me in this problem.

In my content page, I used 2 user controls inside an Ajax Toolkit TabControl. One of the user controls is a data entry with a dropdownlist. The dropdownlist does not retain its selected value when I make a postback (click an update or save button). But when I run it without Tabcontrol, it's ok. Is there anything I should add to the code?

Here's the aspx script:
Expand|Select|Wrap|Line Numbers
  1. <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
  2.  Runat="Server">
  3. <asp:ScriptManager ID="ScriptManager1" runat="server">
  4. </asp:ScriptManager>
  5.  <act:TabContainer ID="TabPanel1" runat="server" ActiveTabIndex="0"   
  6.         Height="600px" CssClass="ajax__tab_xp" OnActiveTabChanged="TabChanged" AutoPostBack="true">
  7.     <act:TabPanel ID="Panel1" runat="server"  
  8.         HeaderText="Client List" ScrollBars="Auto">
  9.            <ContentTemplate>
  10.            <uc2:uc_ClientGrid ID="uc_ClientGrid1" runat="server" />
  11.            </ContentTemplate>
  12.     </act:TabPanel>
  13.    <act:TabPanel ID="TabPanel2" runat="server" 
  14.         HeaderText="Details" >
  15.            <ContentTemplate>
  16.            <uc1:uc_client_info_insert ID="uc_client_info_insert1" runat="server" />
  17.            </ContentTemplate>
  18.     </act:TabPanel>
  19.   </act:TabContainer>
  20. </asp:Content>
  21.  
  22. Here's the user control script:
  23. <asp:UpdatePanel runat="server">
  24. <ContentTemplate>
  25.  
  26.     &nbsp;<asp:Panel ID="pnlClientInfo" runat="server"  
  27.         GroupingText="CLIENTS INFO" Width="400px">
  28.     <table id="tblClientInfo" runat="server" class="clientInfo" >
  29.         <tr>
  30.             <td colspan="2">First Name:<br /><asp:TextBox ID="txtFirstname" runat="server" width="98%"></asp:TextBox></td>
  31.         </tr>
  32.         <tr>
  33.             <td colspan="2">Last name:<br /><asp:TextBox ID="txtLastName" runat="server" width="98%"></asp:TextBox></td>
  34.         </tr>
  35.         <tr>
  36.             <td colspan="2" >Address 1:<br /><asp:TextBox ID="txtAddress1" 
  37.                     runat="server" width="98%"></asp:TextBox></td>
  38.         </tr>
  39.         <tr>
  40.             <td colspan="2" >Address 2 :<br /><asp:TextBox ID="txtAddress2" runat="server" width="98%"></asp:TextBox></td>
  41.         </tr>
  42.         <tr>
  43.             <td>City:<br /><asp:TextBox ID="txtCity" runat="server"></asp:TextBox></td>
  44.             <td>Province:<br />
  45.                 <asp:DropDownList ID="cmbProvinces" runat="server"  >
  46.                 </asp:DropDownList>
  47.             </td>
  48.         </tr>
  49.         <tr>
  50.             <td>Postal Code:<br /><asp:TextBox ID="txtPostalCode" runat="server"></asp:TextBox></td>
  51.             <td>Home Phone:<br /><asp:TextBox ID="txtHomePhone" runat="server"></asp:TextBox></td>
  52.         </tr>
  53.     </table>
  54.     </asp:Panel>
  55. </div>
  56. <div id="msgBox" runat="server" style="font-family: Verdana; font-size: medium; color: #FF0000; font-style: italic">
  57.  
  58. </div>
  59.  
  60. <div >
  61.     <asp:Button ID="btnInsert" runat="server" Text="New" />
  62.     <asp:Button ID="btnUpdate" runat="server" Text="Edit" />
  63.     <asp:Button ID="btnDelete" runat="server" Text="Delete" />
  64.     <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
  65. </div>
  66. </ContentTemplate>
  67.   </asp:UpdatePanel>
  68. </div>
  69.  
Thanks a lot....
Feb 7 '09 #1
5 7479
Frinavale
9,735 Expert Mod 8TB
This is an interesting problem.
I placed a DropDownList in a AjaxToolKit Tab Control and discovered the same problem. In fact it's not that it doesn't retain it's selected value, the selection never even makes it to the server!
Setting the DropDownList's EnableViewState="true" did not help.

I'm interested in the solution to this problem.
Feb 11 '09 #2
dafodil
392 256MB
Try checking your load event because it seems you are AutoPostBacking.
Feb 12 '09 #3
Frinavale
9,735 Expert Mod 8TB
In the load event the selected index remains 0 regardless of selection.
Feb 12 '09 #4
dafodil
392 256MB
This is a bug that Microsoft should fix. If you badly need that control then perhaps using sessions could help.
Feb 13 '09 #5
Do this way for MVC ->
Expand|Select|Wrap|Line Numbers
  1. <%: Html.DropDownListFor(model => model.Address[0].StateCode, new SelectList((IEnumerable<SelectListItem>)ViewData["StateCode"], "Value", "Text", Model.Address[0].StateCode), "--Select--")%>
Mar 14 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: middletree | last post by:
For an ASp Intranet app, I have some code that should work, but I am not able to make it happen for some reason, after spending considerable time on this. I am pretty thick when it comes to...
0
by: Manish | last post by:
Hi All, I'm having this problem I hope someone can help provide a solution for it :) I've this dropdown list box in a usercontrol which I'm populating from the database (it's viewstate property...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
4
by: Greg Scharlemann | last post by:
I'm trying to setup a dyamic dropdown list that displays a number of text fields based on the selected number in the dropdown. The problem I am running into is capturing the data already entered...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
4
by: BillE | last post by:
Can I make the Ajax calendar extender appear on top of dropdown lists instead of behind them? Thanks Bill
11
by: tokcy | last post by:
Hi everyone, I am new in php and ajax, i am facing the prob while i click on element of first drop down then in second dropdown all element showl come from database. I mean i have three dropdown 1....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.