adding a value to Session object

B

Bruno Alexandre

Hi guys,

I'm using Javascript to dynamically add to a dropdown values like
for ( i=0; i<tv.length; i++ ) {
selectDDAvisCtrl.options = new Option(tv, tv);
}

and I use

document.getElementById("ddAvis").options[document.getElementById('ddAvis').selectedIndex].innerHTML;

to access the value of the selected dropdown in Javascript...

now, How can I get the value using ASP.NET 2.0?

the dropdown tag is:
<asp:DropDownList ID="ddAvis" runat="server" CssClass="wizardFormDD" />

I tried:
ddAvis.SelectedValue
ddAvis.Text
ddAvis.SelectIndex
ddAvis.SelectItem

but none can get the selected value in the dropdown:

http://filterqueen.brinkster.net/new_fastcash.dk/users/test.aspx

Please, fell free to change the DropDown with the values 1 to 4 and click
get ddAvis values so you can see that ASP.NET can retrieve the number with
no problems, but if you click the button add new numbers 2 DropDown, I'll
insert the number from 11 to 14 in the dropdownlist and you can navigate
with it, you can also see that I can event get that value in Javascript in
the function show() but if you click get ddAvis values you see that I can't
retrieve any correct number.
 
A

addup

Bruno said:
Hi guys,

I'm using Javascript to dynamically add to a dropdown values like
for ( i=0; i<tv.length; i++ ) {
selectDDAvisCtrl.options = new Option(tv, tv);
}

and I use

document.getElementById("ddAvis").options[document.getElementById('ddAvis').selectedIndex].innerHTML;

to access the value of the selected dropdown in Javascript...

now, How can I get the value using ASP.NET 2.0?

the dropdown tag is:
<asp:DropDownList ID="ddAvis" runat="server" CssClass="wizardFormDD" />

I tried:
ddAvis.SelectedValue
ddAvis.Text
ddAvis.SelectIndex
ddAvis.SelectItem

but none can get the selected value in the dropdown:

http://filterqueen.brinkster.net/new_fastcash.dk/users/test.aspx

Please, fell free to change the DropDown with the values 1 to 4 and click
get ddAvis values so you can see that ASP.NET can retrieve the number with
no problems, but if you click the button add new numbers 2 DropDown, I'll
insert the number from 11 to 14 in the dropdownlist and you can navigate
with it, you can also see that I can event get that value in Javascript in
the function show() but if you click get ddAvis values you see that I can't
retrieve any correct number.


The answer to your question is the forms collection
Request.Form.Item("ddAvis")

This will give you a comma separated list of selected items (i.e the
actual values POSTed by the HTML form)

Having said that... Are you certain you have picked the best way to do
whatever it is you wish to do?
Your list will be recreated at the server side with the original
definition on every postback, any changes to the list made at the
client side will be lost.

-- a --
PS: Your javascript does not work with firefox
 
B

Bruno Alexandre

Hi...

I do not need that information, this is the 1st step of a Loan Application
Form, and the user never get to this page again unless he/she wants to apply
again.

the final work is here if you want to see:

http://filterqueen.brinkster.net/new_fastcash.dk/application/creditApplication_Start.aspx

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"addup" <[email protected]> escreveu na mensagem
Bruno said:
Hi guys,

I'm using Javascript to dynamically add to a dropdown values like
for ( i=0; i<tv.length; i++ ) {
selectDDAvisCtrl.options = new Option(tv, tv);
}

and I use

document.getElementById("ddAvis").options[document.getElementById('ddAvis').selectedIndex].innerHTML;

to access the value of the selected dropdown in Javascript...

now, How can I get the value using ASP.NET 2.0?

the dropdown tag is:
<asp:DropDownList ID="ddAvis" runat="server" CssClass="wizardFormDD" />

I tried:
ddAvis.SelectedValue
ddAvis.Text
ddAvis.SelectIndex
ddAvis.SelectItem

but none can get the selected value in the dropdown:

http://filterqueen.brinkster.net/new_fastcash.dk/users/test.aspx

Please, fell free to change the DropDown with the values 1 to 4 and click
get ddAvis values so you can see that ASP.NET can retrieve the number with
no problems, but if you click the button add new numbers 2 DropDown, I'll
insert the number from 11 to 14 in the dropdownlist and you can navigate
with it, you can also see that I can event get that value in Javascript in
the function show() but if you click get ddAvis values you see that I
can't
retrieve any correct number.


The answer to your question is the forms collection
Request.Form.Item("ddAvis")

This will give you a comma separated list of selected items (i.e the
actual values POSTed by the HTML form)

Having said that... Are you certain you have picked the best way to do
whatever it is you wish to do?
Your list will be recreated at the server side with the original
definition on every postback, any changes to the list made at the
client side will be lost.

-- a --
PS: Your javascript does not work with firefox
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top