Click here to Skip to main content
15,922,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have set validation for DropdownList....Here Im binding the values from Database....How to set validation for This dropDown And Calendar Extender using Ajax contol
Posted
Comments
What validation? Not clear. Where is the issue exactly?
phmani469 12-May-14 4:16am    
How to set validation for DropdownList Control' Here Im binding the dropdownList values from Database.........
What validation you need to implement?
phmani469 12-May-14 4:19am    
If value not selected ...then show the message value is required
That is very easy... Attach one onchange JavaScript event handler for the DropDownList and inside that see what value is selected and validate.

You can use RequiredFieldValidator.
Example - Re: required field validator for dropdownlist[^]

OR

Validate the DropDownList using JavaScript function.
Example - drop down list validation for asp.net[^]
 
Share this answer
 
XML
<script type="text/javascript">



    function IsDropdownChanged() {

        if ($(".DropdownListControlID").change()) {
            alert("Dropdown Changed");
        }

        else {
            alert("Dropdown Not Changed");
        }
    }

</script>



Note: - DropdownListControlID Must be client side ID, get it by using developer tool (F12 on Browser).
 
Share this answer
 
v2

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