c# - ASP.NET Form value validation scenario -


I have the following html in my ASP.NET form. It represents a dropdown menu so that users can choose their own budget. . When a user selects a value on the list, a jquery code project bags a copy of the selected value in the hidden area, so it can be submitted through the form.

  & lt; P & gt; & Lt; Label & gt; Project Budget * & lt; / Label & gt; & Lt; / P & gt; & Lt; A href = "#" class = "SelectionDropdownMenu" & gt; Select the budget value & lt; / A & gt; & Lt; Input id = "projectbizit" class = "inputdumpdown value" runat = "server" type = "hidden" /> & Lt; Ul class = "DropdownMenu" & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; $ 5000 or less & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 5 000 $ - 10 000 dollars & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; $ 10,000 - $ 25,000 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; 25 000 $ - 50 000 $ & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; $ 50 000 - $ 100 000 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; $ 100 000 or more & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; NA & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

This solution worked well for me in the past, but I did not need to do any verification on the field and using an unordered list, our web designers on the dropdown list more Provides flexibility. / P>

However I want to add ASP.NET validation to make budget selection compulsory.

What are my options besides using a DropDownList and using a RequiredFieldValidator?

It looks like you have JavaScript dependencies, so why not use the standard Jquery UI with dropdown list or something that can give you a markup, which is where you Select & gt; element after that you can use the RequiredFieldValidator and want to design flexibility on that markup.

As an added bonus, you can carry JS Dependency (at least for this item).


Comments