SELECT TOP 1 [Salary] FROM ( SELECT DISTINCT TOP 2 [Salary] FROM [dbo].[Employee] ORDER BY [Salary] DESC ) temp ORDER BY [Salary]
Monday, 26 December 2011
Nth Highest Salary Record In Sql Server
Thursday, 15 December 2011
Client Side Validation in asp.net, Required Field,MobileNo,Blank Field
<script language="javascript" type="text/javascript">
function validate() {
if (document.getElementById("<%=txtFirstName.ClientID%>").value == "") {
alert("Name Field can not be blank");
document.getElementById("<%=txtFirstName.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtEmail.ClientID%>").value == "") {
alert("Email Field can not be blank");
document.getElementById("<%=txtEmail.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtPhone.ClientID%>").value == "") {
alert(" Phone Field can not be blank");
document.getElementById("<%=txtPhone.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtEmergencyContact.ClientID%>").value == "") {
alert("Emergency Contact Field can not be blank");
document.getElementById("<%=txtEmergencyContact.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtAge.ClientID%>").value == "") {
alert("Age Field can not be blank");
document.getElementById("<%=txtAge.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtPreferred.ClientID%>").value == "") {
alert("Preferred Partner Field can not be blank");
document.getElementById("<%=txtPreferred.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtPhone.ClientID%>").value == "") {
alert("Mobile No is not valid");
document.getElementById("<%=txtPhone.ClientID%>").focus();
return false;
}
var digits = /^([0-9]{10})$/;
var digitsid = document.getElementById("<%=txtPhone.ClientID %>").value;
var digitsArray = digitsid.match(digits);
var temp;
if (digitsArray == null) {
alert("Your mobile seems incorrect. Please try again.");
document.getElementById("<%=txtPhone.ClientID %>").focus();
return false;
}
var digits = /^([0-9]{10})$/;
var digitsid = document.getElementById("<%=txtEmergencyContact.ClientID %>").value;
var digitsArray = digitsid.match(digits);
var temp;
if (digitsArray == null) {
alert("Your Emergency Contact seems incorrect. Please try again.");
document.getElementById("<%=txtEmergencyContact.ClientID %>").focus();
return false;
}
return true;
}
</script>
In Submit Button We have
<asp:Button CssClass="button" ID="btnNameEmail" runat="server" Text="Submit" OnClick="btnNameEmail_Click" OnClientClick ="return Validate(this)" />
Call the JavaScript Function
function validate() {
if (document.getElementById("<%=txtFirstName.ClientID%>").value == "") {
alert("Name Field can not be blank");
document.getElementById("<%=txtFirstName.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtEmail.ClientID%>").value == "") {
alert("Email Field can not be blank");
document.getElementById("<%=txtEmail.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtPhone.ClientID%>").value == "") {
alert(" Phone Field can not be blank");
document.getElementById("<%=txtPhone.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtEmergencyContact.ClientID%>").value == "") {
alert("Emergency Contact Field can not be blank");
document.getElementById("<%=txtEmergencyContact.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtAge.ClientID%>").value == "") {
alert("Age Field can not be blank");
document.getElementById("<%=txtAge.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtPreferred.ClientID%>").value == "") {
alert("Preferred Partner Field can not be blank");
document.getElementById("<%=txtPreferred.ClientID%>").focus();
return false;
}
if (document.getElementById("<%=txtPhone.ClientID%>").value == "") {
alert("Mobile No is not valid");
document.getElementById("<%=txtPhone.ClientID%>").focus();
return false;
}
var digits = /^([0-9]{10})$/;
var digitsid = document.getElementById("<%=txtPhone.ClientID %>").value;
var digitsArray = digitsid.match(digits);
var temp;
if (digitsArray == null) {
alert("Your mobile seems incorrect. Please try again.");
document.getElementById("<%=txtPhone.ClientID %>").focus();
return false;
}
var digits = /^([0-9]{10})$/;
var digitsid = document.getElementById("<%=txtEmergencyContact.ClientID %>").value;
var digitsArray = digitsid.match(digits);
var temp;
if (digitsArray == null) {
alert("Your Emergency Contact seems incorrect. Please try again.");
document.getElementById("<%=txtEmergencyContact.ClientID %>").focus();
return false;
}
return true;
}
</script>
In Submit Button We have
<asp:Button CssClass="button" ID="btnNameEmail" runat="server" Text="Submit" OnClick="btnNameEmail_Click" OnClientClick ="return Validate(this)" />
Call the JavaScript Function
Friday, 2 December 2011
How to select Only One CheckBox In Grid View
<script type="text/javascript">
function CheckOne(obj) {
var grid = obj.parentNode.parentNode.parentNode;
var inputs = grid.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
if (obj.checked && inputs[i] != obj && inputs[i].checked) {
inputs[i].checked = false;
}
}
}
}
</script>
and Use This
<asp:CheckBox ID="chkSelect" runat="server" onclick ="CheckOne(this)"
/>
function CheckOne(obj) {
var grid = obj.parentNode.parentNode.parentNode;
var inputs = grid.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
if (obj.checked && inputs[i] != obj && inputs[i].checked) {
inputs[i].checked = false;
}
}
}
}
</script>
and Use This
<asp:CheckBox ID="chkSelect" runat="server" onclick ="CheckOne(this)"
/>
Subscribe to:
Posts (Atom)