Display Validation Error Messages inside Popup in ASP.Net

ahmetkilicpa
 
on May 14, 2013 01:39 AM
7978 Views

I have some code about popup and validation ..

I want to do: when I was clicked the btnSubmit if All texts are empty popup will show !!!

My code is here ;

 

<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Drop Effect</title>
<link rel="stylesheet" href="css/drop.css">
<script type="text/javascript">
function ValidateDropDown() {
var value = document.getElementById('<%=TextBox1.ClientID%>').value;
var value2 = document.getElementById('<%=TextBox2.ClientID%>').value;
var ddlVal = document.getElementById("DropDownList1").selectedIndex;

if (value == "" && (ddlVal == 0) && (value2 == "")) {

//alert("Lütfen bir kriter seçiniz..");
topPopup();
return false;


}
else {
//alert("The selected value is : '" + document.getElementById("DropDownList1").value + "'");
alert("Başarıyla yönlendiriliyorsunuz..");

}
}
</script>
</head>
<body>

<div id="confirmation">
<p>Lütfen bir kriter giriniz!</p>
</div>
<script src="js/jquery.js"></script>
<script src="js/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript">
function topPopup() {

//show confirmation
$("#confirmation").effect("drop", { mode: "show", direction: "up" },
function () {
window.timer = function () {
//hide confirmation
$("#confirmation").effect("drop", { mode: "hide", direction: "up" });
}

//hide confirmation after 3 seconds
window.setTimeout("window.timer()", 5000);
});
};
</script>

<form id="Form1" runat ="server">
<asp:DropDownList ID="DropDownList1" runat="server" Height="24px" Width="159px">
<asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Car</asp:ListItem>
<asp:ListItem>Bus</asp:ListItem>
<asp:ListItem>Van</asp:ListItem>
</asp:DropDownList>

<input id="btnSubmit" type="Submit" value="button" onclick="ValidateDropDown()"/>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>


</form>
</body>
</html>

Download FREE API for Word, Excel and PDF in ASP.Net: Download