Textbox value change on select other item dropdownlist

A

Atreju

Ok I got form within a c sharp page.

Situation:
On the form I have a drop downliwst and a textbox, the dropdownlist is
populated with products and the textbox has a default vale of the product
price.

Problem:
The first item prce in the dropdownlist is populated in the textbox.
When I select another product from the dropdownlist the value within the
textbox doesn't change to the price of the selected product.

Question:

Can someone tell me how let the textbox value be changed if another item is
selected from the dropdownlist without having to do a postback(which
immediatly submits the form).

Example data loaded in form:
Productname (loaded in dropdownlist) Productprice (loaded in textbox)
Chocolate chips 1,-
Strawberry 0,50

Thank,
A
 
P

Paul Henderson

Can someone tell me how let the textbox value be changed if another item is
selected from the dropdownlist without having to do a postback(which
immediatly submits the form).

You could store the prices into a Javascript array using the
ClientScript object, and set up a client-side event handler (e.g.
OnClientChange) that retrieves the corresponding element from the array
and puts it in the textbox.

[This is really an ASP.NET question, rather than C#, so perhaps post on
microsoft.public.dotnet.framework.aspnet if you have any other
questions that don't follow on from this one]
 
A

Atreju

Moved to microsoft.public.dotnet.framework.aspnet group

Thanks!

Paul Henderson said:
Can someone tell me how let the textbox value be changed if another item
is
selected from the dropdownlist without having to do a postback(which
immediatly submits the form).

You could store the prices into a Javascript array using the
ClientScript object, and set up a client-side event handler (e.g.
OnClientChange) that retrieves the corresponding element from the array
and puts it in the textbox.

[This is really an ASP.NET question, rather than C#, so perhaps post on
microsoft.public.dotnet.framework.aspnet if you have any other
questions that don't follow on from this one]
 

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