Category Archives: RegularExpressionValidator

RegularExpressionValidator

[RESOLVED]javascript should work after Regular Expression Validatior

Hi all,

        I have a form named ChangePassword.aspx. Here I am having 3 text boxes, 1st one is for old password, 2nd is for new password and the 3rd one is for confirm password.

       

 <tr>
            <td align="left" class="nbdcontent" style="width: 143px; height: 19px">
                Enter old password</td>
            <td align="center" class="nbdcontent" style="width: 10px; height: 19px">
                :</td>
            <td align="left" style="width: 100px; height: 19px">
                <asp:TextBox ID="txtOldpass" runat="server" CssClass="mytextbox" TextMode="Password"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvOldpass" runat="server" ControlToValidate="txtOldpass"
                    ErrorMessage="Please enter Old Password !">*</asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td align="right" class="nbdcontent" style="height: 19px" colspan="3">
                         <asp:RegularExpressionValidator ID="Regex2" runat="server" ControlToValidate="txtNewPass"
    ValidationExpression="[a-z]+"
    ErrorMessage="Minimum 8 characters atleast 1 Alphabet, 1 Number and 1 Special Character" 
                             ForeColor="Red" >*</asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td align="left" class="nbdcontent" style="width: 143px; height: 19px">
                Enter new password</td>
            <td align="center" class="nbdcontent" style="width: 10px; height: 19px">
                :</td>
            <td align="left" style="width: 100px; height: 19px">
                <asp:TextBox ID="txtNewPass" runat="server" CssClass="mytextbox" 
                    TextMode="Password"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvNpass" runat="server" ControlToValidate="txtNewPass"
                    ErrorMessage="Please enter New Password !">*</asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td align="right" class="nbdcontent" style="height: 19px" colspan="3">
                         <asp:RegularExpressionValidator ID="Regex3" runat="server" ControlToValidate="txtNCpass"
    ValidationExpression="^(?=.*[A-Za-z])(?=.*d)(?=.*[$@$!%*#?&])[A-Za-zd$@$!%*#?&]{8,}$"
    ErrorMessage="Minimum 8 characters atleast 1 Alphabet, 1 Number and 1 Special Character" 
                             ForeColor="Red" >*</asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td align="left" class="nbdcontent" style="width: 143px; height: 19px">
                Confirm password</td>
            <td align="center" class="nbdcontent" style="width: 10px; height: 19px">
                :</td>
            <td align="left" style="width: 100px; height: 19px">
                <asp:TextBox ID="txtNCpass" runat="server" CssClass="mytextbox" 
                    TextMode="Password"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvNCP" runat="server" ControlToValidate="txtNCpass"
                    ErrorMessage="Please enter confirm New  Password">*</asp:RequiredFieldValidator>
                <asp:CompareValidator ID="cvNPass" runat="server" ControlToCompare="txtNewPass" ControlToValidate="txtNCpass"
                    ErrorMessage="Password did not match !">*</asp:CompareValidator></td>
        </tr>
        <tr>
            <td align="left" class="nbdcontent" style="width: 143px; height: 19px">
            </td>
            <td align="center" class="nbdcontent" style="width: 10px; height: 19px">
            </td>
            <td align="left" style="width: 100px; height: 19px">
            </td>
        </tr>
        <tr>
            <td align="left" class="nbdcontent" style="width: 143px; height: 19px">
            </td>
            <td align="center" class="nbdcontent" style="width: 10px; height: 19px">
            </td>
            <td align="left" style="width: 100px; height: 19px">
                <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Update" />

Here I I have used RegularExpressionValidator  for password complexity. I am also encrypting the password word on client side.

below is my code for encrypting password.

<script type="text/javascript" src="../js/md5.js">  </script>
    <script type="text/javascript">

     function ChangePwd(salt) {

         var control = "<%=txtOldpass.ClientID %>";
         if (document.getElementById(control).value != "") {

             document.getElementById(control).value =
                    hex_md5(document.getElementById(control).value);

             document.getElementById(control).value =
                    hex_md5(document.getElementById(control).value + salt);
         }

         var control2 = "<%=txtNCpass.ClientID %>";
         if (document.getElementById(control2).value != "") {
         

             document.getElementById(control2).value =
                    hex_md5(document.getElementById(control2).value);
         }

         var control3 = "<%=txtNewPass.ClientID %>";
         if (document.getElementById(control3).value != "") {
           
             document.getElementById(control3).value =
                    hex_md5(document.getElementById(control3).value);
         }
     }
    </script>

and on page load

I am adding an attribute to the button

Button1.Attributes.Add("onclick", "return ChangePwd('" + salt.ToString() + "'); ToggleButton();");

The problem is :- as I click the button to change the password, it encrypt the entered string in the textboxes. As the password is encrypted now doesn’t meet the password complexity.

I want that, first it run the regular expression validator then it should encrypt the password.

Any Idea how to achieve this.

Hi demoninside,

Thanks for your post.

As for your problem, in fact, RegularExpressionValidator control validates the value of “txtNCpass” two times. The first time, when “txtNCpass” TextBox lose focus, RegularExpressionValidator control validates the value of “txtNCpass”. The second time, if
you click Button1, the page will refesh and RegularExpressionValidator control validates the value again. In this situation, encrypted password will not meet the password complexity.

To solve this problem, we could set IsValid property to true from behind code as below.

protected void Button1_Click(object sender, EventArgs e)
{
    Regex3.IsValid = true;
} 

Hope it will be helpful to you.

Best Regards,

Fei Han

Textbox should allow only alphanumeric values

Hi,

  I have three textboxes one after another in three rows.In tat i need to enter a ID, so to validate that textbox i have written Javascript function in a seperated Jquery file . Now i need to validate that the textbox should allow only alphanumeric values
.this validation is called in the save button once after entering the data in the textbox. Please help me how to write the validation for allowing in the Alphanumeric values.

 

Thanks,

RaS89

Why do n;t you use REgularExpression Validator. See the following for regular expression for alphanumeric:

http://regexlib.com/Search.aspx?k=alphanumeric

Thanks fr your reply ,

But we have to write only javascript function fr validations. we should nt use validators in this becoz the textboxes are inside a panel.Enitre applications validations are done in Javascript.Please suggest any javascript functions for this..

thanks,

Hi,

please try this code in this article:

http://www.hscripts.com/scripts/JavaScript/alphanumeric-check.php

 

Hope it helps.

 

if(document.getElementById(txtWorldviewId1).getAttribute(‘value’)
!=
||document.getElementById(txtWorldviewId2).getAttribute(‘value’)
!=
||document.getElementById(txtWorldviewId3).getAttribute(‘value’)
!=
)

{

 

alert ("some message");

}

 

i need to write javascript function like the above query.fr this can you  please help me like tis..

 

 

thanks,
Ras89

Danny Gokey


has posted a good url. I am pasting the code for your ease here:

<script type="text/javascript">
function alphanumeric(alphane)
{
	var numaric = alphane;
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
		  }
		else {
                         alert("Your Alpha Numeric Test Failed");
			 return false;
		  }
 		}
 alert("Your Alpha Numeric Test Passed");
 return true;
}
</script>

You can call this function on the click of a button for every text box separatly. Pass the text of the textbox and get the text in the javascript function and evaluate.


Check the code

  • <div class="comment-right-col"> <div>

    <div>

     

    <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="maxchar"></asp:TextBox>

    <asp:RegularExpressionValidator

    ID="RegularExpressionValidator1"

    runat="server"

    ErrorMessage="only
    characters allowed"

    ControlToValidate="TextBox1"

    ValidationExpression="^[a-z]*$" ></asp:RegularExpressionValidator>

    <br />


    </div>



    </div> </div>

for more detail check the link

http://forums.asp.net/t/1272776.aspx/2/10

http://hiox.org/14313-allow-only-alphabets-for-textbox.php

Hello,

Try this expression with "^[a-zA-Z0-9_]*" with regular expression validator

Refer here

http://www.aspsnippets.com/Articles/TextBox-Validation-using-JavaScript.aspx

Navigate to the bottom of page for live demo

Try this

In design

onkeypress="return alphanumeric_only(this);"

function alphanumeric_only(e)
        {

            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (event) keycode = event.keyCode;
            else if (e) keycode = e.which;

            else return true;
            if( (keycode >= 47 && keycode <= 57) || (keycode >= 65 && keycode <= 90) || (keycode >= 95 && keycode <= 122) )

            {
                
                return true;
            }

            else

            {
                alert("Please do not use special characters")
                return false;
            }
            
            return true;
         }

Hi,

You can use regular expression validator.

And your regular expression can be evaluated from following links:

Javascript Regular Expression Validator | Regular Expressions Library and Testing Tool

Regular Expression Library

Hi ,

Thanks fr your reply .I have tried ths code but its nt accepting spcl character but its accepting " / " slash in the textbox

tat should also nt be allowed so wat correction i can do  fr that

 

Thanks,
ras89

Have you tried the link I gave you?

Hi,

Try this,

Change this part alone

if( (keycode >= 48 && keycode <= 57) || (keycode >= 65 && keycode <= 90) || (keycode >= 95 && keycode <= 122) )

            {
            }

reply me..

yes it should not allow spcl characters if spcl character is clicked,the enterd text should be cleared from the textbox. on keypress event..

Please help me on that

 

Thanks,

Ras89

The link I gave you does not allow special characters? Have you tried demo on the site

Just Change that IF loop alone as below

if( (keycode >= 48 && keycode <= 57) || (keycode >= 65 && keycode <= 90) || (keycode >= 95 && keycode <= 122) )

            {
            }

Now try

i ii work for u..

Reply..

Hi,

Check the following snippet!

Only Alphabets:<input type="text" onkeydown="return OnlyAlphabets(event);" />
 <script type="text/javascript">
 function OnlyAlphabets(evt) {
                var charCode = evt.keyCode;
                if (charCode == 8 || //backspace
                charCode == 46 || //delete
                charCode == 13)   //enter key
                {
                    return true;
                }
                else if (charCode >= 37 && charCode <= 40) //arrow keys
                {
                    return true;
                }
                else if (charCode >= 65 && charCode <= 91) //a-z on num pad
                {
                    return true;
                }
                else
                    return false;
            }

</script>

Hope it helps u…

Hi,

I have asked for not allowing spcl character in a textbox.i have used the above mentioned if loop.But now its accepting _ & ~ & ` spcl characters so what keycode can i add in the above loop.Please suggest me . 

Thanks,

RAS89

Hi,

Try this link for keycodes and u can change that IF Loop
as and how u want

http://www.expandinghead.net/keycode.html


Hi

add a regular expression validator.

Set the control to validate as the propert text box

in the expression to validate add the following

"^[a-zA-Z0-9_]*$"

[RESOLVED]WebNumericEdit control in Asp.net

Hi All,

             I am facing a problem while using WebNumericEdit in my asp.net code.  I want it to accept values between -9999999999999999.99

and 9999999999999999.99. But it is not working as i wish. I have set its data mode as Decimal. I have to accept only two digits after decimal not more than that. 

For example if i enter value as -999999999999999.94 it automatically convert it in to -1000000000000000 which i don’t want. It should accept it as it is. I have set it Max value to 9999999999999999.99 and Min value to -9999999999999999.99.

Kindly help and please tell me why it is always rounding off the number.

Hi,

Please refer to MaskedEdit.

MaskedEdit is an ASP.NET AJAX extender that attaches to a TextBox control to restrict the kind of text that can be entered.            MaskedEdit applies a "mask" to the input that permits only certain types of characters/text to be entered.            The
supported data formats are: Number, Date, Time, and DateTime.            MaskedEdit uses the culture settings specified in the CultureName property. If none is specified            the culture setting will be the same as the page:
English (United States).

More details, please refer to:

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/MaskedEdit/MaskedEdit.aspx.

You can use asp.net validation to achieve this goal. Following code will restrict user within limits and don’t allowed to enter number more than 2 decimal places.

<asp:TextBox ID="txtAmount" runat="server" />
<asp:Button ID="btnSaveDetails" runat="server" Text="Submit" OnClick="btnSaveDetails_Click" />
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" Display="Dynamic" ErrorMessage="Amount is required!" ControlToValidate="txtAmount"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="rvDecimal" ControlToValidate="txtAmount" runat="server" ErrorMessage="Please enter a valid amount." ValidationExpression="^(-)?d+(.dd)?$"></asp:RegularExpressionValidator>
<asp:RangeValidator runat="server" Type="Double" ControlToValidate="txtAmount" Display="Dynamic" MinimumValue="-9999999999999999.99" MaximumValue="9999999999999999.99" ErrorMessage="Value isn't in range!"></asp:RangeValidator>

Your code behind

protected  void btnSaveDetails_Click(object sender, EventArgs e)
{
            
}

[RESOLVED]Validating text and numbers

Hi all

I’m trying to validate the user input from a textbox and allow users only type any number and/or alphabetic characters. Special characters are not allowed.
I used the following code:

var checkInput = /w/;
   if(!checkInput.test(sender.value))
       alert("Only numbers and alphabetic charactes are alllowed.");

However, this failed for the following input 1<ss>qq and the following error bubble up:
A potentially dangerous Request.Form value was detected from the client (txtIdPersonal="1<ss>qq")

I also tried with the following regular expresion:  /^[A-Za-z0-9]{1,7}/; But the result is the same.
It seems like the <, > special characters between any number or alphabetic character are not detected.

Does anyone know how can I validate it?

Any help on this would be very usefull

Regards!

If you are using web forms try using a RegularExpressionValidator with the following expression: "^[0-9a-zA-Z]+$" This will make sure no charaters get by if javascript is disabled on the page. Make sure to check if the page is valid though on the button
click event before processing the data supplied If Page.IsValid…

As for JavaScript portion you can call a function like so to check if a valid charater was presssed:

function validateChar(sentChar) {
    !(/^[A-z0-9]*$/i).test(sentChar.value)?sentChar.value = sentChar.value.replace(/[^A-z0-9]/ig,''):null;
}

Then

<input type="text" onkeyup="validateChar(this)" onblur="validateChar(this)">

This should only allow the user to enter alphanumeric characters.

Forgot to add if you are using an asp.net control you can add the onkeyup and onblur to the control through the pageload method like so:

TextBox1.Attributes.Add("onkeyup", "validateChar(this);");
TextBox1.Attributes.Add("onblur", "validateChar(this);");

Hi cool

Thanks for your comment, however I would like to implement it in javascript. I’m using VS 2005 and I will need to download the ajax toolkit to use what you suggest. And due to some security guideline I can’t do that.

Also, I’ll trying to use a Custom RegularExpression Validator, I will doing some tests.

Reagards!

I added the JavaScript portion to my comment above.
Check it out hope it helps.

Hi jprochazka

I just wrote about the use of the RegularExpressionValidator, then I put the expression you posted and it worked OK.

I’ll be testing your suggestion in the javascript code

Thanks so much :-)

Regards!

[RESOLVED]How to Clear the text in textbox while using ValidatorCalloutExtender?

Hi,

      I am using  ‘ValidatorCalloutExtender’ for textbox, after clicking the cancel button in the Extender Box i want to clear the text in the  textbox .Any one suggest me the solution..

try to clear like this

textbo1.Text ="";

validator.Text="";

validator.EnableClientScript = false;

Thank you  for the reply,

       can you please explain me clearly, i mean where i have to use that lines of code.

Text.Trim();

txtname.Text="";

Txtname.Text =null;

in your code behind..

if you have button u can write that code in button Click Event

Here is my Aspx page code :

<asp:TextBox ID="txtImageId" runat="server" Width="100px"></asp:TextBox>
<asp:RegularExpressionValidator ID="ImageID" runat="server" ErrorMessage="Enter only digits & length greater than 5 "
                        ControlToValidate="txtImageId" Display="None" ValidationExpression="d{0,5}"></asp:RegularExpressionValidator>
<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="ImageID"
                        CssClass="CustomValidatorCalloutStyle" PopupPosition="TopLeft">
                    </asp:ValidatorCalloutExtender>


If validation occurs in the textbox then  this ExtenderBox will come ,by clicking cancel button the text in textbox has to clear.

can you post your complete aspx code? including your buttons?

here it is in aspx page

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:TextBox ID="txtImageId" runat="server" Width="100px"></asp:TextBox>
<asp:RegularExpressionValidator ID="ImageID" runat="server" ErrorMessage="Enter only digits & length greater than 5 "
ControlToValidate="txtImageId" Display="None" ValidationExpression="d{0,5}"></asp:RegularExpressionValidator><asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="ImageID"
CssClass="CustomValidatorCalloutStyle" PopupPosition="TopLeft">
</asp:ValidatorCalloutExtender>

in cs page

protected void Button1_Click(object sender, EventArgs e)
{
txtImageId.Text = "";

}

I am generating ValidatorCalloutExtender on tab key press, i dont want to perform that action on button click

ValidatorCalloutExtender + CustomValidator – It´s possible?

WHERE´S THE ValidatorCalloutExtender?

Where´s ValidatorCalloutExtender? 

 

Portuguese Question
—————————————————-
Estou tentando chamar um ValidatorCalloutExtender a partir de um CustomValidator, alguém aqui já fez isso? Isso é possível? Pois no meu exemplo abaixo isso não funciona.

 

English Question
—————————————————-
I can try to call ValidatorCalloutExtender from a CustomValidator, but it´s not work. It´s possíble? My example doesn´t work.
PLEASE HELP ME!

——————————————————————————————————————————————————————————————- 
teste.aspx 
——————————————————————————————————————————————————————————————- 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="teste.aspx.cs" Inherits="teste" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


        <asp:CustomValidator ID="CustomValidator1" ControlToValidate="TextBox1" runat="server" ErrorMessage="weadsasdsa" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
        <ajaxToolkit:ValidatorCalloutExtender ID="ceUsuarioNome" TargetControlID="CustomValidator1" runat="server"></ajaxToolkit:ValidatorCalloutExtender>


        <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    </form>
</body>
</html>

 

——————————————————————————————————————————————————————————————- 
teste.aspx.cs
——————————————————————————————————————————————————————————————- 

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class teste : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
        if(TextBox1.Text == "janis"){
            args.IsValid = true;
        }else{
            args.IsValid = false;
        }
    }
}

 

 

I believe, from
looking at the ValidatorCallout known issues
, that it only works on CustomValidators
with client-side validation (i.e., JavaScript).  Here’s the part of the sentence:

"…will only work for custom validators which utilize client-side validation."

Can you show some exemple code??
I´m having this problem too.
[:(]

Tks…
See yaa!

From what I’ve seen, you cannot use the ValidatorCalloutExtender when the CustomValidator is using a server side validation.  In this case the solution is relatively simple.  Instead of using a CustomValidator, try using a RegularExpressionValidator.  I’ve
tested the following at it will work with ValidatorCalloutExtender without a postback. 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" Title="Untitled Page" StylesheetTheme="SkinFile" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
            <div>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" Text="Button" />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                    ControlToValidate="TextBox1" Display="None" ErrorMessage="weadsasdsa"
                    ValidationExpression="janis" />
                <ajaxToolkit:ValidatorCalloutExtender ID="ceUsuarioNome"
                    TargetControlID="RegularExpressionValidator1" runat="server" />
   

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

  

If you still want to use a CustomValidator, then create a ClientValidationFunction instead of a server side function.  The following demonstrates an example of this.

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" Title="Untitled Page" StylesheetTheme="SkinFile" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript">
           function ClientValidate(source, clientside_arguments)
           {
              if (clientside_arguments.Value == "janis" )
              {
                 clientside_arguments.IsValid = true;
              }
              else { clientside_arguments.IsValid = false; }
           }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
            <div>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" Text="Button" />
                <asp:CustomValidator ID="CustomValidator1" runat="server" Display="None" ErrorMessage="Error"
                    ControlToValidate="TextBox1" ClientValidationFunction="ClientValidate" />
                <ajaxToolkit:ValidatorCalloutExtender ID="ceUsuarioNome" TargetControlID="CustomValidator1"
                    runat="server" />
            </div>
        </form>
    </body>
</html>

  

or in your custom validator place a field to validate it could be any text box but validate callout needs something ,

<asp:CustomValidator
ID="RCVlen2"
ControlToValidate="wid3"
runat="server"
ErrorMessage="Adjust
end widths"
ClientValidationFunction="ValidateCheckBox"
Display="None"></asp:CustomValidator>

<asp:ValidatorCalloutExtender
ID="vcblen2C2"
runat="server"
TargetControlID="RCVlen2"
CssClass="vcall">

 

ValidatorCalloutExtender and Modal popup

Hi guys

Well this is doing my nut in.

I have a Modal popup that has a text box (for time) and 2 buttons (OK, Cancel)

I have some validation on the text box but when my ValidatorCalloutExtender pops it displays behind the popup window. 

I have tried the following

1) Chaning the z-axis;

modalPopupBehavior._backgroundElement.style.zIndex = 20000;
modalPopupBehavior._foregroundElement.style.zIndex = 30000;

2) Putting style=’position: relative;’ in a panel

I’d pull my hair out if there was any left

Hi,

Please descirbe more details, and post some related code.

Panel is called from

<asp:Label ID="lblinsertpopup" runat="server"></asp:Label>
<cc1:ModalPopupExtender ID="lateModalAbs" runat="server" TargetControlID="lblinsertpopup"
                                PopupControlID="pnlMarkLate" BackgroundCssClass="modalBackground" CancelControlID="btnLateCancel"
                                DynamicServicePath="" Enabled="True">
</cc1:ModalPopupExtender>

This is the panal

<asp:Panel ID="pnlMarkLate" CssClass="panelPopUp" runat="server" Width="200px" Height="140px" style='position: relative;' >
        <div id="Div9" class="layer" runat="server">
            <span id="Span2" class="msgheader" style="margin-top: 10px">Confirm?</span><hr />
            <br />
            <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                <ContentTemplate>

                        <span id="lateMsg" class="msg" runat="server"></span>
                        <br />
                        <div style="display: inline; padding-left: 30px" id="LateTime" style="position:relative">
                            <asp:Label ID="lblTime" runat="server" Text='Late Time' Width="70px"></asp:Label>
                            <asp:TextBox ID="txtTime" runat="server" CssClass="Gridview_Textbox"
                                Width="120px"></asp:TextBox>

                            <asp:RequiredFieldValidator ID="reqTime" runat="server" ErrorMessage="*"
                                Text="*" ControlToValidate="txtTime" Width="0"  >
                            </asp:RequiredFieldValidator>
                            <cc1:ValidatorCalloutExtender ID="reqTimeCallout" runat="server"
                                Enabled="True" TargetControlID="reqTime" PopupPosition="BottomLeft">
                            </cc1:ValidatorCalloutExtender>
                            
                            <asp:RegularExpressionValidator ID="regValTime" runat="server" ControlToValidate="txtTime"
                                ErrorMessage="Invalid Time Format" Text="*" Width="0"
                                ValidationExpression="^(([0-2][0-3]|[0-1][0-9])(:)[0-5][0-9](:)[0-5][0-9])$">
                            </asp:RegularExpressionValidator>
                            <cc1:ValidatorCalloutExtender ID="regValTime_ValidatorCalloutExtender" runat="server"
                                Enabled="True" TargetControlID="regValTime">
                            </cc1:ValidatorCalloutExtender>
                        </div>
                    <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel3"
                        DisplayAfter="100">
                        <ProgressTemplate>
                            <img id="gif" class="gif" src="Images/loader.gif" alt="Processing" /><span id="progressTitle"
                                class="progressTitle">Processing Requested Action. Please Wait...</span>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    <div style="margin-left: 5%; margin-top: 25%; width: 90%">
                        <asp:Button ID="btnLateOk" runat="server" Text="OK" OnClick="btnLateOk_Click" CausesValidation="true"/>
                        <asp:Button ID="btnLateCancel" runat="server" Text="Cancel" />
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </asp:Panel>

If I add "" as the txtTime or an invalid date then the error pops up but it is behind the modal popup.

Here is what the error looks like.

http://www.flickr.com/photos/76052669@N06/6828890349/in/photostream

Hi,

Could you make a simple demo page? So I may reproduct your scenario on my side.

Did you have any luck with this?

As I have also a problem with the validatorcallout extender displaying below textboxes and buttons

thanks

Glen