473,387 Members | 1,512 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.

get value of asp:ListBox

Hi again!

Right, okay... im now trying to get the value of an <asp:TextBox> control.
so I have on my ASPX page...

<asp:ListBox id="results" runat="server"></asp:ListBox>
<asp:TextBox id="txtSelected" runat="server"></asp:TextBox>

In my code-behind Page_Load i have..
results.Items.Add("Dan");
results.Items.Add("Fred");

I double clicked the listbox and it the createdresults_SelectedIndexChanged
function for me, to which ive added...

txtSelected.Text = results.SelectedItem.Value;

It doesn't work! Tried various properties from ListBox, nothing seems to
work. It's not even refreshing the page. It just does nothing. Not sure if
it's the code or I've created the wrong function (maybe results_OnClick is
better?).

help :)

cheers
Dan
Nov 18 '05 #1
2 2268
probably the control lost the attached event. So try to go control properties
to see if the control still have the events atacched. Or probably you didn't
set the property autopostback = true.

"Dan Nash" wrote:
Hi again!

Right, okay... im now trying to get the value of an <asp:TextBox> control.
so I have on my ASPX page...

<asp:ListBox id="results" runat="server"></asp:ListBox>
<asp:TextBox id="txtSelected" runat="server"></asp:TextBox>

In my code-behind Page_Load i have..
results.Items.Add("Dan");
results.Items.Add("Fred");

I double clicked the listbox and it the createdresults_SelectedIndexChanged
function for me, to which ive added...

txtSelected.Text = results.SelectedItem.Value;

It doesn't work! Tried various properties from ListBox, nothing seems to
work. It's not even refreshing the page. It just does nothing. Not sure if
it's the code or I've created the wrong function (maybe results_OnClick is
better?).

help :)

cheers
Dan

Nov 18 '05 #2
thanks mate - twas the postback! ill get used to it all eventually - sooo
different from asp :)

"Psycho" wrote:
probably the control lost the attached event. So try to go control properties
to see if the control still have the events atacched. Or probably you didn't
set the property autopostback = true.

"Dan Nash" wrote:
Hi again!

Right, okay... im now trying to get the value of an <asp:TextBox> control.
so I have on my ASPX page...

<asp:ListBox id="results" runat="server"></asp:ListBox>
<asp:TextBox id="txtSelected" runat="server"></asp:TextBox>

In my code-behind Page_Load i have..
results.Items.Add("Dan");
results.Items.Add("Fred");

I double clicked the listbox and it the createdresults_SelectedIndexChanged
function for me, to which ive added...

txtSelected.Text = results.SelectedItem.Value;

It doesn't work! Tried various properties from ListBox, nothing seems to
work. It's not even refreshing the page. It just does nothing. Not sure if
it's the code or I've created the wrong function (maybe results_OnClick is
better?).

help :)

cheers
Dan

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Richard Fennell | last post by:
I am trying to use asp:listbox on a form, when a user selects a row in the asp:listbox a panel is displayed on the centre of the screen with a message, a bit like a model dialog on the form. The...
1
by: Daniel | last post by:
hi, I had an asp:listbox, and everytime i click item inside, the bar automatically go to the top, is there any way to keep the scroll position? I turn on the smartNavigation, it still doesn't...
3
by: Ryan Taylor | last post by:
Hello. I have an application where I need the user to be able to add items to a listbox. I've implemented this via javascript. The listbox is an <asp:ListBox>. However, when the user submits the...
1
by: Dave | last post by:
Hi, Is there a way to capture an ItemDataBound event on an asp:listbox when it's bound to data? I don't see it as a available when I try to create an event handler. Dave
1
by: dhnriverside | last post by:
Hi guys I've got a List of items for editing a Contact. Basically, it's a list of groups - a contact can be a member of as many as possible, or a member of one. Is there a way to make...
2
by: Mark Rae | last post by:
Hi, Looking for some advice again... Imagine two ListBox controls denoting something like students and team membership e.g. many students can be members of many teams (e.g. the hockey team,...
0
by: sasankasekhar2003 | last post by:
i have a textbox txtName (web form element) 2 listboxes lstAll (web form element) (autopostback=false, select=multiple) lstSel (web form element)(autopostback=false,...
1
by: joeyaeb | last post by:
I have a web form with 3 listboxes. I've created a dataset with 3 related tables with the following characteristics: Table Desc Key(s) 1 Projects ProjectID ...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of "Multiple". The user can select multiple dates from the listbox. I have ObjectDataSource named "ods_rfq" with a...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...

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.