G
Guest
Hello together,
I tried to find out about populating an asp.net server control (a
dropdownlist) from the clientside jscript, but I didn't find a solution up
to now.
I cannot use a html dropdownlist, because a database query in codebehind has
to be done, when a new listItem is selected. So, I need to use a
servercontrol dropdownlist.
Now to my problem:
I have two dropdownlists in use. One of them should show listItems that are
dependent on the selection of the other one. I know that I need to use the
clientside onchange() Event on the dropdownlistbox that decides what has to
be shown in the other dropdownlist, because no postback should occur for this.
The C# syntax, that is used in codebehind, doesn't work, JScript gives me an
error that the object doesn't support this method.
I can set the text and state of servercontrols like textBoxes and checkBoxes
from clientside jscript with document.Form1.TextBox1..., so it should also be
possible to do this with a dropdownlist too, shouldn't it?
I tried it with Ajax.NET, but when I called a serverside function that
should manipulate the dropdownlist, a nullpointerexception occurs, because
all the instances of the serverside controls are "undefined" (I saw it in the
debugger). I've no explanation for this, as they are created on page_Load. So
I cancelled my efforts introducing Ajax into this. As the project is nearly
finished, I would like to avoid using Ajax for the dropdownlist stuff.
I hope somebody can help
Thanks in advance
RFS666
I tried to find out about populating an asp.net server control (a
dropdownlist) from the clientside jscript, but I didn't find a solution up
to now.
I cannot use a html dropdownlist, because a database query in codebehind has
to be done, when a new listItem is selected. So, I need to use a
servercontrol dropdownlist.
Now to my problem:
I have two dropdownlists in use. One of them should show listItems that are
dependent on the selection of the other one. I know that I need to use the
clientside onchange() Event on the dropdownlistbox that decides what has to
be shown in the other dropdownlist, because no postback should occur for this.
The C# syntax, that is used in codebehind, doesn't work, JScript gives me an
error that the object doesn't support this method.
I can set the text and state of servercontrols like textBoxes and checkBoxes
from clientside jscript with document.Form1.TextBox1..., so it should also be
possible to do this with a dropdownlist too, shouldn't it?
I tried it with Ajax.NET, but when I called a serverside function that
should manipulate the dropdownlist, a nullpointerexception occurs, because
all the instances of the serverside controls are "undefined" (I saw it in the
debugger). I've no explanation for this, as they are created on page_Load. So
I cancelled my efforts introducing Ajax into this. As the project is nearly
finished, I would like to avoid using Ajax for the dropdownlist stuff.
I hope somebody can help
Thanks in advance
RFS666