473,770 Members | 4,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox on an AJAX TAB CONTAINER postback problem

1 New Member
Good Morning,
I have a problem with my listbox control, and i tried everything i found on the web but maybe i'm still missing something.
I have a listbox that i control with a datatable <the data table is populated through a data layer which is a seperate application> and i bind it to the listbox,
on selecting an item from that listbox, a second dropdownlistbox should be activated.

My problem is that when i do postback to activate the second dropdownlistbox , the first get emptied, i dont know whats the problem.

here is my code.
<source code>
Expand|Select|Wrap|Line Numbers
  1. <asp:DropDownList ID="IndexDropDownList" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
  2.                                             Height="18px" Width="301px" 
  3.                                             onselectedindexchanged="IndexDropDownList_SelectedIndexChanged">
on behind page code is
Expand|Select|Wrap|Line Numbers
  1. public partial class markit_Index : System.Web.UI.Page
  2. {
  3.     protected void Page_Load(object sender, EventArgs e)
  4.     {
  5.         if (!IsPostBack)
  6.         {
  7.             DataTable data = new DataTable();
  8.  
  9.             Getdata();
  10.       }
  11.    }
  12.  
  13. protected void  Getdata ()
  14.     {
  15.         DataSet MyDataset = new DataSet();
  16.  
  17.  
  18.         CurveDao iDao = new CurveDao("", ContextManager.oracleSession);
  19.  
  20.         DataTable data = iDao.GetIndexCompositionData();
  21.         Session["GetIndexCompositionData"]= data;
  22.  
  23.         DataTable table = new DataTable();
  24.         table.Columns.Add("Index Name");
  25.         foreach (DataRow row in data.Select())
  26.         {
  27.             DataRow NewRow = table.NewRow();
  28.             String IndexName = row["Name"].ToString();
  29.             NewRow["Name"] = Name;
  30.                  table.Rows.Add(NewRow);
  31.         }
  32.         IndexDropDownList.DataSource =table;
  33.         IndexDropDownList.DataTextField = "Name";
  34.         IndexDropDownList.DataBind();
  35.  
  36.     }
  37.  
  38.  protected void IndexDropDownList_SelectedIndexChanged(object sender, EventArgs e)
  39.     {
  40.  
  41.  
  42.         IndexNameDropDownList.Enabled = true;
  43.  
  44.      }
  45.  
  46. }

Thanks for the help !!
Aug 6 '08 #1
0 1140

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

Similar topics

1
8421
by: Edward | last post by:
I am having a terrible time getting anything useful out of a listbox on my web form. I am populating it with the results from Postcode lookup software, and it is showing the results fine. What I want to do is to allow the user to click on the row that corresponds to the correct address, and have the code behind populate the form's Address1, Address2 etc. controls with the relevant data items. I put the code for this into the...
8
2357
by: Steve Schroeder | last post by:
For some reason I cannot get the OnSelectedIndexChanged event to fire for a listbox I have on a page. I'm able to populate the listbox with data from a stored procedure, but cannot trigger the event. I do have EnableViewState = True for the listbox. I'm imagining (wanting) to populate the listbox named: lstNames by using the DataValueField from lstDepartments. It's quite apparent though that the event is not triggering as I can misname...
10
3303
by: Adam Clauss | last post by:
I have a page containing a list box. This list may contain duplicate items - in which the ORDER is important. ex: a b b a is significant as compared to: b
9
3249
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback). This listbox has AutoPostback = True. When the user selects an item from this list, the second listbox is populated with more items relevant to this selection. I am using an SQLDataSource web control for this. These items are headers. I want, when...
2
2036
by: Jeremy | last post by:
I've got a very large listbox that gets populated using ajax. The listbox and a button are in a panel inside an update panel. The button click of the button sets the panel visible property to false. Everything works nice and snappy except for when I click the button. The panel takes about 20 or so seconds to dissapear. I think the ajax call has been made and the browser is executing some javascript synchronously because the browser is...
7
5619
by: Lit | last post by:
Hi, How can I capture the vertical scroll bar position for a Listbox. I have a Listbox of 100 items + when I click on it I post back remove the item selected. After returning to the client browser the list box scroll position is at the top.
1
1288
by: Frank | last post by:
Hello all, I have 3 listboxes on my page, they all contain the same data. How can I avoid sending the THREE complete lists with data on the webpage? I would like to sent only 1 list with data and use it in all three listboxes. Remark, maybe of interest: the listboxes are on 3 different tabs in an ajax tabcontainer. Thank you Frank
3
6391
by: Mel | last post by:
On a tab I have one DropDownList which requires a postback and two ListBoxes which do not require any postback because I just have some javascript, defined in the aspx file, to copy items from one listbox to the other. All 3 of these controls exist in a table which is inside an UpdatePanel. When the drop down list value changes and the postback occurs the data that I had in my listbox control disappears. How do I fix this? (using:...
0
1830
by: Mel | last post by:
On Oct 23, 8:30 am, bruce barker <nos...@nospam.comwrote: Huh? Did you mean Listbox not DropDownList? The drop-down is working fine, it's the Listbox data that gets cleared after the drop-down list causes the postback.
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10005
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.