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

Should be simple...

Rob
I am new to asp.net.... but this should be simple, yet it does not appear to
work. I must be doing something wrong.

I have a web form with a dropdown list. I have successfully populated it
with data from sql server using a datareader.

How do you reference the item that you selected in the dropdown list (after
you select it) ?

My dropdown list is called ddJob.

I tried to simply place the value I selected into a text box....

Within the ddJob_SelectedIndexChanged I tried...

Textbox1.Text=ddJob.SelectedValue

But nothing happens when I select a value form the dropdown list..... Why ?

Thanks !

Sep 28 '06 #1
4 1079
Rob wrote:
I am new to asp.net.... but this should be simple, yet it does not appear to
work. I must be doing something wrong.

I have a web form with a dropdown list. I have successfully populated it
with data from sql server using a datareader.

How do you reference the item that you selected in the dropdown list (after
you select it) ?

My dropdown list is called ddJob.

I tried to simply place the value I selected into a text box....

Within the ddJob_SelectedIndexChanged I tried...

Textbox1.Text=ddJob.SelectedValue

But nothing happens when I select a value form the dropdown list..... Why ?

Thanks !
Is the dropdownlist being rebound on each page load? If so, the data is
being lost. You need to put the binding code in something like:

if(!IsPostBack)
{
// code here
}

Sep 28 '06 #2
Hi Rob,

You are nearly doing everything right!
It seems you are missing one little thing.
Its called "AutoPostBack" and it needs to be set to true.
Its on the drop down list properties.

What this means is that when you change the selected index, it will
post the data back to the server immediately, rather than when a button
is clicked.

Try it out!

Steven

Sep 28 '06 #3
hello,
use this..
Textbox1.Text=ddJob..SelectedItem.Text
regards

Rob wrote:
I am new to asp.net.... but this should be simple, yet it does not appear to
work. I must be doing something wrong.

I have a web form with a dropdown list. I have successfully populated it
with data from sql server using a datareader.

How do you reference the item that you selected in the dropdown list (after
you select it) ?

My dropdown list is called ddJob.

I tried to simply place the value I selected into a text box....

Within the ddJob_SelectedIndexChanged I tried...

Textbox1.Text=ddJob.SelectedValue

But nothing happens when I select a value form the dropdown list..... Why ?

Thanks !
Sep 28 '06 #4
Rob
Steven,

Thank You very much ! It works now....

Rob

"Steven Nagy" <le*********@hotmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi Rob,

You are nearly doing everything right!
It seems you are missing one little thing.
Its called "AutoPostBack" and it needs to be set to true.
Its on the drop down list properties.

What this means is that when you change the selected index, it will
post the data back to the server immediately, rather than when a button
is clicked.

Try it out!

Steven

Sep 28 '06 #5

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

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
22
by: Alexander Schmolck | last post by:
Two smallish things that have been bugging me; I'm not sure whether they're actually broken or not, but anyway here it goes: 1. ``os.system`` (and co): Shouldn't ``os.system``'s signature really...
124
by: 43 | last post by:
how come m$Office isn't written in .net? how come Open Office isn't written in j2ee? how come dbms systems aren't written in either? how come browsers aren't written in either? how come...
36
by: Jack Hughes | last post by:
This argument has come up two or three times lately. We have a web standards document at our company that say "Use valid HTML 4; We don't recommend switching to DIV-based CSS-P for layout just...
5
by: AES/newspost | last post by:
I've just re-scanned most of the 60+ posts in the "Frames are Evil" thread, and my question, as the admittedly and permanently amateur creator and maintainer of a simple site, is: Using only...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
21
by: TAM | last post by:
Hi, I read that ASP.NET uses VB.NET instead of VBScript. I also read that ASP.NET is a subset of VB.NET. So if I learn VB.NET first then do I have the knowledge for programming ASP.NET...
10
by: Solo.Wolve | last post by:
Well,I read <c primer plusbefore,and I just got a primary conclusion about c. Can somebody show me some books to read and something to do ? I study c myself.btw,I am not a student, Thanks.
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - When should I use eval? ----------------------------------------------------------------------- The ` eval() `...
4
by: sinbad | last post by:
how can i write a program, which should accept input as NAME of a variable in the program and print it's value.Is this possible. for example. int main () { int x,y,z; x = 10; y = 20; z = 30;
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: 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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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.