<script language="javascript" type="text/javascript">
function checkuserEmail(txt) {
var valuseremail = txt;
if (valuseremail != "") {
WebService.check_ContentEditor_userEmail(valuseremail, OnSucceeded, OnFailed);
}
}
function OnSucceeded(result, userContext, methodName) {
var userarray = result;
document.getElementById('<%=lblresult.ClientID %>').innerHTML = userarray;
if (userarray != "<font color='green'>EmaiID Available,Please proceed !</font>") {
document.getElementById('<%=txtEmail.ClientID %>').value = "";
}
}
function OnFailed(error, userContext, methodName) {
alert("An Error Occured During Check Your EmailID. Please Try After Some Time!!!");
}
</script>
<asp:TextBox ID="txtEmail" runat="server" CssClass="serachtext1" onblur="checkuserEmail(this.value);"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_txtEmail" runat="server" ControlToValidate="txtEmail"
Display="None" SetFocusOnError="true" ErrorMessage="Enter EmailID" ValidationGroup="Insert"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="VCE3_txtEmail" CssClass="customCalloutStyle"
runat="server" WarningIconImageUrl="~/images/ajaxerror.png" CloseImageUrl="~/images/ajaxclose.png"
TargetControlID="RFV_txtEmail">
</ajaxToolkit:ValidatorCalloutExtender>
<asp:RegularExpressionValidator ID="REV_txtEmail" runat="server" ControlToValidate="txtEmail"
Display="None" SetFocusOnError="true" ErrorMessage="Enter valid EmailID" ValidationGroup="Insert"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="VCE2_txtEmail" CssClass="customCalloutStyle"
runat="server" WarningIconImageUrl="~/images/ajaxerror.png" CloseImageUrl="~/images/ajaxclose.png"
TargetControlID="REV_txtEmail">
</ajaxToolkit:ValidatorCalloutExtender>
<asp:Label ID="lblresult" runat="server" Font-Bold="False" ForeColor="Red" Text=""></asp:Label>
[WebMethod]
public string check_ContentEditor_userEmail(string emailid)
{
try
{
BAL.TravelBAL objtravelbal = new BAL.TravelBAL();
DataSet ds = new DataSet();
ds = objtravelbal.Get_CityContentEditor_ByEmail(emailid);
string result = "";
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
result = "<font color='red'>EmaiID Already Exist,Please Enter Another EmailID!</font>";
}
else
{
result = "<font color='green'>EmaiID Available,Please proceed !</font>";
}
return result;
}
catch (Exception ex)
{
string result = "Error occur during checking your EmaiID";
return result;
}
}
No comments:
Post a Comment