By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

Web - Posting Back On A SelectedIndexChanged

P: n/a
I have a DropDownList that I would like to post back to the server when
the selected index changes. Using Visual Studio, I simply
double-clicked the DropDownList on the form and that created the
function call where I put my code, all well and good. But in practice,
changing the selection does not post back to the server and, thus, does
not run the code when I need it to be run. Is there a way to make this
happen?

I realize that conducting a postback on such an event isn't always the
best way to do things in the first place, but in this specific case on
this specific form it would pretty much be the best way to go. Any ideas?
Regards,
David P. Donahue
dd******@ccs.neu.edu
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
There's an autopostback property on the control that should be set to true
for this behaviour.

You're right though, that performing a postback isn't such a good way of
doing things because of the delay, but that said, for such an argument there
are always exceptions.

What are you doing with your server side code on the selection change?

Daniel.

"David P. Donahue" <dd******@ccs.neu.edu> wrote in message
news:Or****************@TK2MSFTNGP15.phx.gbl...
I have a DropDownList that I would like to post back to the server when the
selected index changes. Using Visual Studio, I simply double-clicked the
DropDownList on the form and that created the function call where I put my
code, all well and good. But in practice, changing the selection does not
post back to the server and, thus, does not run the code when I need it to
be run. Is there a way to make this happen?

I realize that conducting a postback on such an event isn't always the
best way to do things in the first place, but in this specific case on
this specific form it would pretty much be the best way to go. Any ideas?
Regards,
David P. Donahue
dd******@ccs.neu.edu

Nov 16 '05 #2

P: n/a
> There's an autopostback property on the control that should be set to true
for this behaviour.
Ah, I guess I missed that one. Works now, thanks :)
You're right though, that performing a postback isn't such a good way of
doing things because of the delay, but that said, for such an argument there
are always exceptions.

What are you doing with your server side code on the selection change?


To simplify the numbers: DropDownList A has 100 options. For each
option in A, DropDownList B has 100 options. Sending _all_ of B to the
client each time the page is loaded would slow things down a bit much.
Especially when you consider that 90% of the users will probably never
change the default selection in A (and, thus, never need to re-populate
B after the initial page load). So, when A changes, B gets populated by
"SELECT foo FROM bar WHERE something=A.Value"

Of course, if there is a better way to do this, I'm all ears. This just
seemed the simplest to implement without terribly sacrificing
performance for the user.
Regards,
David P. Donahue
dd******@ccs.neu.edu
Nov 16 '05 #3

P: n/a
In this case posting back is definately the way to go in my opinion. Sending
masses of data to the client is going to loose when put up against your
option of posting back with gradual amounts of data.
"David P. Donahue" <dd******@ccs.neu.edu> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
There's an autopostback property on the control that should be set to
true for this behaviour.


Ah, I guess I missed that one. Works now, thanks :)
You're right though, that performing a postback isn't such a good way of
doing things because of the delay, but that said, for such an argument
there are always exceptions.

What are you doing with your server side code on the selection change?


To simplify the numbers: DropDownList A has 100 options. For each option
in A, DropDownList B has 100 options. Sending _all_ of B to the client
each time the page is loaded would slow things down a bit much. Especially
when you consider that 90% of the users will probably never change the
default selection in A (and, thus, never need to re-populate B after the
initial page load). So, when A changes, B gets populated by "SELECT foo
FROM bar WHERE something=A.Value"

Of course, if there is a better way to do this, I'm all ears. This just
seemed the simplest to implement without terribly sacrificing performance
for the user.
Regards,
David P. Donahue
dd******@ccs.neu.edu

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.