Click here to Skip to main content
15,905,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i am new in development field..and i want to use validaton on i am not getting any idea..when to use customvalidator or some defined validators on this control or any control..if i specify just validator on control except custom...pls i wanna make it clear..the basic me out...i have used 6 validaotrs already on different controls..but i am nt quite pls any one help me out...thanks in advance...

1 solution


I use javascript for validating controls.

You can my code for validating your control with some changes.

<html xmlns="">
<head runat="server">
    <script language ="javascript" >
        function f1() {

            if (parseInt(document.getElementById("DropDownList1").selectedIndex) > 0) {
                alert("you selected option");
            else {
                alert("you are Not selected ");
    <form id="form1" runat="server">
    <div id="divid" runat="server"></div>
     <input type ="file" id="fileupload1" />
     <input type ="button" value="change" onclick ="f1()" />
        <asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" xmlns:asp="#unknown" />
           <select name="DropDownList1" id="DropDownList1">
	<option value="dfgdfgfdg">dfgdfgfg</option>
	<option value="tytytrytry">uytuytuy</option>
	<option value="ghj">hjghj</option>
	<option value="ghjhhj">yuiyui</option>


You can change above to achieve your requirement.

All the Best
Share this answer
keshav kumar jha 22-Sep-11 5:12am    
thnx a lot..

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