Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have tow dropdownlists the first dropdownlist is a category of items
and second dropdownlist is items and have text box is prise of item
>> i want to do when i select itemname from dropdownlist2 the prog.
print item prise which i selected from dropdownlist in a textbox as a out put

What I have tried:

i havebeen connect the program to database (sql server 2008) and linked category with items in dropdownlists but i cant linked txtbox with items to print item prise from database
Posted
Updated 6-Feb-17 19:16pm
Comments
[no name] 6-Feb-17 15:40pm    
"i cant linked txtbox with items to print item prise from database", and why can't you?
SmartDeveloping 6-Feb-17 17:02pm    
Is this needed in C#? Javascript?

Not quite clear on the ask. I get that you have 2 drop downs. One for category, the second for a specific product. The textbox is to display the price?

One question for me would be if you are doing this in ASP.NET MVC?

When I have done similar things in an ASP.NET MVC application, the solution I might suggest is to have a trigger on the second box to call a simple webapi that would return the price for the product selected.

Calling the webapi can be done very simply using a bit of javascript. If you are familiar with using JQuery, it is simple to attach a script to the change event of the second drop down and then make the call to get the price which is then populated into the text box.

Here is a link to an article that dicusses the approach. http://stackoverflow.com/questions/15239782/calling-webapi-from-jquery
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900