473,378 Members | 1,156 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,378 software developers and data experts.

Listbox on an AJAX TAB CONTAINER postback problem

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 1122

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

Similar topics

1
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...
8
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...
10
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
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)....
2
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...
7
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...
1
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...
3
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.