Click here to Skip to main content
15,917,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to write JQuery script in Razor for DropDownList ,When Keyboard is selected a value has to display in quantity text box

@Html.LabelFor(a => a.ProductName)


C#
@Html.DropDownListFor(a => a.ProductName, new List<SelectListItem>
                {
                   new SelectListItem{ Text="keyboard", Value = "keyboard" },
                   new SelectListItem{ Text="Mouse", Value = "Mouse" },
                   new SelectListItem{ Text="Hard Disk", Value = "Hard Disk" },
                }, "--Select--")

Posted
Updated 16-Nov-14 23:10pm
v7
Comments
[no name] 17-Nov-14 5:07am    
Please brief again what exactly is your requirement. Not clear.
Member 11166907 17-Nov-14 5:11am    
I want to add Validation in JQuery For DropDownList "ProductName'
[no name] 17-Nov-14 7:40am    
You mean if nothing is selected you need to alert user that please choose. Right??
Member 11166907 17-Nov-14 8:00am    
yes I want do that in JQuery
Member 11166907 17-Nov-14 8:02am    
When I click submit Button. It has to check the validation and then the selection has to execute

1 solution

Check the below fiddle.
Fiddle[^]
On click of submit it says the field is required if none is selected. I have used jquery validator here.
Hope this helps.
Thanks
 
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