Category Archives: RequiredFieldValidator

RequiredFieldValidator

[RESOLVED]table format change with a RequiredFieldValidator

Hi my format is this without a RequiredFieldValidator

and this is my format WITH a RequiredFieldValidator

why it change like that?

this is my code

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

<!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></title>
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery-ui.js" type="text/javascript"></script>
    <link href="css/jquery-ui.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function () {
            $("[id$=txtFechaDesAdenda]").datepicker({
                firstDay: 1,
                dateFormat: 'dd/mm/yy',
                showOn: 'button',
                buttonImageOnly: true,
                buttonImage: 'images/Calendar-Logo-16x16.png',
                monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
                dayNamesMin: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab']
                //onSelect: function (date) { alert(date) }
            });
        });

        function keyUP(e) {
            e = e || window.event;
            el = e.srcElement || e.target;
            el.value = el.value.split('.').join(',');
        }
    </script>
    <style type="text/css">
        .text-izq
        {
            text-align: left;
        }
        .centrar
        {
            vertical-align:middle;
            text-align:center;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblDireccionArchivo" runat="server" Text="" Visible="false"></asp:Label>
        <div style="text-align:center;">
        <table class="centrar" border="2">
            <tr>
                <td align="center">
                    <asp:Label ID="lblAlerta" runat="server" Text="" Visible="false"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <asp:DropDownList ID="ddlPrestamos" runat="server" AppendDataBoundItems="true">
                    </asp:DropDownList>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvddlPrestamos" InitialValue=".: PRÉSTAMOS :." ControlToValidate="ddlPrestamos" runat="server" ErrorMessage="Seleccione Un Préstamo" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <asp:DropDownList ID="ddlDesesAdenda" runat="server">
                    </asp:DropDownList>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvddlDesesAdenda" InitialValue=".: SELECCIONAR :." ControlToValidate="ddlDesesAdenda" runat="server" ErrorMessage="Seleccione una opción" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="border-color:Black; border-width:medium;">
                    Fecha Desestimiento o Adenda: 
                </td>
                <td align="left" style="border-color:Black; border-width:medium;">
                    <asp:TextBox ID="txtFechaDesAdenda" runat="server"></asp:TextBox>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvtxtFechaDesAdenda" ControlToValidate="txtFechaDesAdenda" runat="server" ErrorMessage="Ingrese una fecha" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="border-color:Black; border-width:medium;">
                    Monto Desestimiento o Adenda: 
                </td>
                <td align="left" style="border-color:Black; border-width:medium;">
                    <asp:TextBox ID="txtMontoDesAdenda" runat="server" CssClass="text-izq" onkeyup="return keyUP(event)" ></asp:TextBox>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvtxtMontoDesAdenda" ControlToValidate="txtMontoDesAdenda" runat="server" ErrorMessage="Ingrese un Monto" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="border-color:Black; border-width:medium;">
                    Observaciones:
                </td>
                <td align="left" style="border-color:Black; border-width:medium;">
                    <asp:TextBox ID="txtObservaciones" runat="server" TextMode="MultiLine" CssClass="text-izq"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>Documentación Digitalizada (Tamaño Máximo 50 MB) <img src="images/pdf-icon.png" /></strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:FileUpload ID="fulArchivo" runat="server" AutoPostBack="true" />
                </td>
            </tr>
                <td colspan="2">
                    <strong><asp:Label runat="server" ID="lblUpload" ForeColor="#00CC00" /></strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>NOMBRE DEL ARCHIVO </strong>
                    <br />
                    <strong><asp:Label runat="server" ID="lblNombreArchivo" /></strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnUpload" runat="server" Text="Cargar Archivo" OnClick="btnUpload_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnGuardar" runat="server" Text="Guardar" onclick="btnGuardar_Click1" Visible="false"/>
                </td>
            </tr>
        </table>
        </div> 
    </div>
    </form>
</body>
</html>

.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Drawing;

using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Data.Common;
using System.Data.OleDb;

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

public partial class Desestimientos_Adendas : System.Web.UI.Page
{
    private string connectionString = WebConfigurationManager.ConnectionStrings["sigademu"].ConnectionString;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LlenarddlPrestamos();
            string prestamo_id = Convert.ToString(ddlPrestamos.SelectedValue);
            FillddlDesesAdenda();
        }
    }

    #region void FillddlDesesAdenda()
    protected void FillddlDesesAdenda()
    {
        ddlDesesAdenda.Items.Insert(0, ".: SELECCIONAR :.");
        ddlDesesAdenda.Items.Insert(1, "Desestimiento");
        ddlDesesAdenda.Items.Insert(2, "Adenda");
    }
    #endregion

    protected void LlenarddlPrestamos()
    {
        SqlConnection cnx = new SqlConnection(connectionString);
        cnx.Open();

        SqlCommand cmd = new SqlCommand("SELECT DISTINCT prestamo_id,codigo_interno,acreedor_id FROM tblPrestamos WHERE prestamo_id <> 'SGDM-27' AND prestamo_id <> 'SGDM-29' AND prestamo_id <> 'SGDM-30' AND prestamo_id <> 'SGDM-47' AND prestamo_id <> 'SGDM-49' AND prestamo_id <> 'SGDM-50' AND prestamo_id <> 'SGDM-51' AND prestamo_id <> 'SGDM-52' AND prestamo_id <> 'SGDM-53' AND prestamo_id <> 'SGDM-54' AND prestamo_id <> 'SGDM-55' AND prestamo_id <> 'SGDM-56' AND prestamo_id <> 'SGDM-54' AND prestamo_id <> 'SGDM-53' ORDER BY codigo_interno ASC ", cnx);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        adp.Fill(dt);
        cnx.Close();
        ddlPrestamos.DataSource = dt;
        ddlPrestamos.Items.Insert(0, ".: PRÉSTAMOS :.");

        ddlPrestamos.DataTextField = "codigo_interno";
        ddlPrestamos.DataValueField = "prestamo_id";
        ddlPrestamos.DataBind();
        

    }

    #region btnUpload_Click
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        Boolean fileOk = false;
        DateTime fec1 = Convert.ToDateTime(txtFechaDesAdenda.Text);
        string fec2 = fec1.ToString("yyyy-MM-dd");
        string NombreArchivo = ddlPrestamos.SelectedItem + "_" + fec2;
        lblNombreArchivo.Text = NombreArchivo;
        String path = Server.MapPath("~/Docs/Desestimientos_Adendas/");
        String direccion = "~/Docs/Desestimientos_Adendas/";


        if (fulArchivo.HasFile)
        {
            int fileSize = fulArchivo.PostedFile.ContentLength;
            if (fileSize < 420000000)
            {
                string FileExtension = System.IO.Path.GetExtension(fulArchivo.FileName).ToLower();
                string allowwExtension1 = ".pdf";
                string allowwExtension2 = ".doc";
                string allowwExtension3 = ".docx";
                string allowwExtension4 = ".xls";
                string allowwExtension5 = ".xlsx";
                if (FileExtension == allowwExtension1 || FileExtension == allowwExtension2 || FileExtension == allowwExtension3 || FileExtension == allowwExtension4 || FileExtension == allowwExtension5)
                {
                    fileOk = true;
                }

            }
            else
            {
                fileOk = false;
            }
        }
        if (fileOk)
        {
            try
            {
                //GUARDAR CON EL NOMBRE POR DEFECTO EL ARCHIVO
                //fulArchivo.PostedFile.SaveAs(path + fulArchivo.FileName);

                //GUARDAR CON OTRO NOMBRE EL ARCHIVO QUE SE CARGO
                path += NombreArchivo;
                direccion += NombreArchivo;
                string FileExtension = System.IO.Path.GetExtension(fulArchivo.FileName).ToLower();
                path += FileExtension;
                direccion += FileExtension;
                lblDireccionArchivo.Text = direccion.ToString();
                fulArchivo.PostedFile.SaveAs(path);
                // ES DECIR POR TEXTBOX
                lblUpload.Text = "Su Archivo Se Cargo Exitosamente";
                btnGuardar.Visible = true;
                btnUpload.Visible = false;
            }
            catch
            {
                lblUpload.Text = "Su Archivo No Se logro Cargar" + "El Archivo no Es PDF o Exedio el Tamaño de Archivo";
            }
        }
        else
        {
            lblUpload.Text = "No existe Archivo Seleccionado ";
        }
    }
    #endregion

    protected void btnGuardar_Click1(object sender, EventArgs e)
    {
        string prestamo_id = ddlPrestamos.SelectedValue.ToString();
        string deses_adenda = ddlDesesAdenda.SelectedIndex.ToString();//0=seleccionar, 1=desestimiento, 2=adenda

        //if (txtFechaDesAdenda.Text == "" || txtFechaDesAdenda.Text == null)
        //{
        //    lblAlertaFecha.Visible = true;
        //}

        DateTime fechaDesesAdenda_0 = Convert.ToDateTime(txtFechaDesAdenda.Text);
        string fechaDesesAdenda = fechaDesesAdenda_0.ToString("dd/MM/yyyy");

        decimal montoDesesAdenda = Convert.ToDecimal(txtMontoDesAdenda.Text);

        string observaciones = txtObservaciones.Text;

        string pathArchivo = lblDireccionArchivo.Text;

        string UsuCre = Convert.ToString(Session["usuario"]);
        DateTime FechaCre = DateTime.Now;

        SqlConnection cnx = new SqlConnection(connectionString);

        try
        {
            SqlCommand command = new SqlCommand("InsertDesestimientoAdenda", cnx);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add("@prestamo_id", SqlDbType.VarChar).Value = prestamo_id;
            command.Parameters.Add("@deses_adenda", SqlDbType.Int).Value = deses_adenda;
            command.Parameters.Add("@fechaDesesAdenda", SqlDbType.DateTime).Value = fechaDesesAdenda;
            command.Parameters.Add("@montoDesesAdenda", SqlDbType.Decimal).Value = montoDesesAdenda;
            command.Parameters.Add("@observaciones", SqlDbType.VarChar).Value = observaciones;
            command.Parameters.Add("@pathArchivo", SqlDbType.VarChar).Value = pathArchivo;
            command.Parameters.Add("@UsuCre", SqlDbType.VarChar).Value = UsuCre;
            command.Parameters.Add("@FechaCre", SqlDbType.DateTime).Value = FechaCre;
            cnx.Open();
            command.ExecuteNonQuery();
            lblAlerta.Visible = true;
            lblAlerta.Text = "Registro Exitoso!!!";
            lblAlerta.ForeColor = System.Drawing.Color.Green;
        }
        catch (SqlException ex)
        {
            lblAlerta.Visible = true;
            lblAlerta.Text = "SQL ERROR: " + ex.Message.ToString();
            lblAlerta.ForeColor = System.Drawing.Color.Red;
        }
        finally
        {
            cnx.Close();
            //Response.Redirect("~/RegistroCuotas.aspx", true);
            Response.AddHeader("REFRESH", "10;URL=Principal.aspx");
        }

    }


}

Hi gokufast,

For your issue ,i suggest that you can try to remove "border-width:medium" in your  code like below:

 

gokufast

<td align="right" style="border-color:Black; border-width:medium;">

Here is the page code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../Scripts/jquery-1.10.2.js"></script>
    <link href="../Scripts/jquery-ui-1.10.4.custom.css" rel="stylesheet" />
    <script src="../Scripts/jquery-ui-1.10.4.custom.js"></script>
    <script type="text/javascript">
        $(function () {
            $("[id$=txtFechaDesAdenda]").datepicker({
                firstDay: 1,
                dateFormat: 'dd/mm/yy',
                showOn: 'button',
                buttonImageOnly: true,
                buttonImage: 'images/Calendar-Logo-16x16.png',
                monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
                dayNamesMin: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab']
                //onSelect: function (date) { alert(date) }
            });
        });

        function keyUP(e) {
            e = e || window.event;
            el = e.srcElement || e.target;
            el.value = el.value.split('.').join(',');
        }
    </script>
    <style type="text/css">
        .text-izq
        {
            text-align: left;
        }
        .centrar
        {
            vertical-align:middle;
            text-align:center;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lblDireccionArchivo" runat="server" Text="" Visible="false"></asp:Label>
        <div style="text-align:center;">
        <table class="centrar" border="1">
            <tr>
                <td align="center">
                    <asp:Label ID="lblAlerta" runat="server" Text="" Visible="false"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <asp:DropDownList ID="ddlPrestamos" runat="server" AppendDataBoundItems="true">
                    </asp:DropDownList>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvddlPrestamos" InitialValue=".: PRÉSTAMOS :." ControlToValidate="ddlPrestamos" runat="server" ErrorMessage="Seleccione Un Préstamo" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2">
                    <asp:DropDownList ID="ddlDesesAdenda" runat="server">
                    </asp:DropDownList>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvddlDesesAdenda" InitialValue=".: SELECCIONAR :." ControlToValidate="ddlDesesAdenda" runat="server" ErrorMessage="Seleccione una opción" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="border-color:Black;">
                    Fecha Desestimiento o Adenda: 
                </td>
                <td  style="border-color:Black;">
                    <asp:TextBox ID="txtFechaDesAdenda" runat="server"></asp:TextBox>
 
                </td>
                <td align="left" style="border-color:Black;">

                      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" InitialValue=".: SELECCIONAR :." ControlToValidate="ddlDesesAdenda" runat="server" ErrorMessage="Seleccione una opción" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="border-color:Black;">
                    Monto Desestimiento o Adenda: 
                </td>
                <td align="left" style="border-color:Black;">
                    <asp:TextBox ID="txtMontoDesAdenda" runat="server" CssClass="text-izq" onkeyup="return keyUP(event)" ></asp:TextBox>
                </td>
                <td align="left">
                    <asp:RequiredFieldValidator ID="rfvtxtMontoDesAdenda" ControlToValidate="txtMontoDesAdenda" runat="server" ErrorMessage="Ingrese un Monto" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
             <td align="right" style="border-color:Black; border-width:medium;">                    Observaciones:
                </td>
                <td align="left" style="border-color:Black; border-width:medium;">
                    <asp:TextBox ID="txtObservaciones" runat="server" TextMode="MultiLine" CssClass="text-izq"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>Documentación Digitalizada (Tamaño Máximo 50 MB) <img src="images/pdf-icon.png" /></strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:FileUpload ID="fulArchivo" runat="server" AutoPostBack="true" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong><asp:Label runat="server" ID="lblUpload" ForeColor="#00CC00" /></strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <strong>NOMBRE DEL ARCHIVO </strong>
                    <br />
                    <strong><asp:Label runat="server" ID="lblNombreArchivo" /></strong>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnUpload" runat="server" Text="Cargar Archivo" OnClick="btnUpload_Click1" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnGuardar" runat="server" Text="Guardar" onclick="btnGuardar_Click2" Visible="false"/>
                </td>
            </tr>
        </table>
        </div> 
    </div>
    </form>
</body>
</html>

Best Regards,

Kevin Shen.

wow, thanks

[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

[RESOLVED]Validating textbox onblur with VB validaitor

        First Name:<asp:TextBox 
            ID="First" runat="server"></asp:TextBox>
        *<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="First" Display="Dynamic" ErrorMessage="Enter Client First Name" 
            SetFocusOnError="True" ValidationGroup="gp1" BackColor="#FFFFCC"></asp:RequiredFieldValidator>

I have 2 group validation on submit which are working fine. what I would like to be able to do is -

When user leave the textbox I want the validator to run and check it if there is an Error I would like to have a popup box or even some kind of Error message showing and prevent the user from continue to the next filed? is it possible to do with .net or
should I create a js script if I do need to create this script can you refer me to somewhere where there is some example on how to do it.  ** as of right now with IE11 no error show. and you can continue without any problem. **

Thank you

Also Can I use something like onBlue="Page_ClientValidate()" that will be on to the specified field instead for the whole page?

Add the below script and change the validate data

   <script type ="text/javascript">
         $(document).ready(function () {
           
             $('#<%=First.ClientID%>').blur(function () {
                 if ($('#<%=First.ClientID%>').val() != "abc")
                 {
                     $('#<%=First.ClientID%>').focus();
                     alert('Please enter valid data.');
                     
                     return false;
                 }
                
             });
         });
         
        
        

  </script>

You can also use Javascript to validate the textbox like given below

<script>
        function ValidateTextbox() {
            //Get the textbox obect here
            var txtbox = document.getElementById('<%=First.ClientID%>');

            //Check if the textbox is empty o not
            if (txtbox.value == "") {
                //Show an alert message
                alert('Please enter some value');
                //Set the focus to textbox so that 
                txtbox.focus();
                return false;
            }
            else {
                return true;
            }
        }
    </script>

Complete Code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    <script>
        function ValidateTextbox() {
            //Get the textbox obect here
            var txtbox = document.getElementById('<%=First.ClientID%>');

            //Check if the textbox is empty o not
            if (txtbox.value == "") {
                //Show an alert message
                alert('Please enter some value');
                //Set the focus to textbox so that 
                txtbox.focus();
                return false;
            }
            else {
                return true;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="First" runat="server" onblur="return ValidateTextbox();"></asp:TextBox>
        
    </form>
</body>
</html>

Can I just use my current validator like the page_clientvalidator does? I ask because I have over 40 fields with different validations and it will way quicker to add just onblur event then right JS for every different validator.

Thank you for your reply

Hi eli2011,

Thanks for your post.

As for your problem, you could try A2H’s solution. Besides, you could try the below code.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../../Scripts/jquery-1.8.2.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#First").blur(function () {
                var valid = window.RequiredFieldValidator1.isvalid;
                if (!valid) {
                    alert("Please Enter First Name!");
                }
            });

            $("#Last").blur(function () {
                var valid = window.RequiredFieldValidator2.isvalid;
                if (!valid) {
                    alert("Please Enter Last Name!");
                }
            });
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            First Name:<asp:TextBox
                ID="First" runat="server"></asp:TextBox>
            *<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                ControlToValidate="First" Display="Dynamic" ErrorMessage="Enter Client First Name"
                SetFocusOnError="True" ValidationGroup="gp1" BackColor="#FFFFCC"></asp:RequiredFieldValidator>
            <br />
            Last Name:<asp:TextBox
                ID="Last" runat="server"></asp:TextBox>
            *<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                ControlToValidate="Last" Display="Dynamic" ErrorMessage="Enter Client Last Name"
                SetFocusOnError="True" ValidationGroup="gp1" BackColor="#FFFFCC"></asp:RequiredFieldValidator>
        </div>
    </form>
</body>
</html> 

Hope it will be helpful to you.

Best Regards,

Fei Han

$(document).ready(function () {

  $("#First").focusout(function () {

   /* IF YOU DON'T NEED CHECKS ON SERVER SIDE  */

   if ($("#First").val() == '') {

        /* Here you can load a dialog with jquery*/

    }

    /*  IF YOU NEED CHECKS ON SERVER SIDE */

      params = {/*Your vars here*/}

      $.ajax({
         type: 'POST',
         url: '@Url.Action("YourFunctionName", "YourControllerName")',
          contentType: "application/json; charset=utf-8",
          data: JSON.stringify(params),
          success: function (data) { },

          error: function (request, status, error) { /* Here you can load a dialog with jquery*/} 

 }); }); });

In the dialog you can choose to do a thing or other depending the clicked button:

        $("#dialog-access-confirm").dialog({
            closeOnEscape: false,
            resizable: false,
            modal: true,
            height: "auto",
            dialogClass: "roundCorners",
            buttons: {
                '@ViewData("btnPopupConfirm")': function () {
                    $(this).dialog("close");
                    executeEditAction(urlmethod, true);
                },
                '@ViewData("btnPopupCancel")': function () {
                    $(this).dialog("close");
                }
            }
        });

ValidatorCalloutExtender displays in a different place on postback

There are two ways that I invoke the ValidatorCalloutExtender, from the client side and the server side.

When invoked from the client side it displays correctly (more or less), in-line with TextBox but when invoked from the server side the ValidatorCalloutExtender displays in the upper left corner of the ModalPopupExtender’s Panel

I have reduced the HTML and code down to the bare minimum for ease of viewing, while maintaining the issue.

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="WebForm1.aspx.cs" Inherits="EAAP.WebForm1" %>
<!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></title></head>
<body>
<form id="form1" runat="server">
	<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" AsyncPostBackTimeout="600" 
		ScriptMode="Debug" EnablePartialRendering="true" EnablePageMethods="true" LoadScriptsBeforeUI="true" />
	<asp:Button ID="Button_Show" runat="server" Text="New" Width="60" />
	<asp:ModalPopupExtender ID="ModalPopupExtender_Server_New" runat="server" Drag="true"
		PopupControlID="Panel_Server_New" TargetControlID="Button_Show" BackgroundCssClass="modalPopUpBackground" >
	</asp:ModalPopupExtender>
	<asp:Panel runat="server" ID="Panel_Server_New" style="display:none;border:7px solid #56575a;background-color:#56575a" >
		<table width="100%" style="border-collapse:collapse; padding:0;" cellpadding="0">
			<tr>
				<td>
					<asp:TextBox ID="TextBox1" runat="server" MaxLength="15" />
					<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="None" 
						ControlToValidate="TextBox1" ErrorMessage="Required Field" InitialValue="" 
						ValidationGroup="ValidationGroup_Server_INSERT" />
					<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" 
						CssClass="ValidatorCalloutExtender" PopupPosition="Right" 
						TargetControlID="RequiredFieldValidator1"
						WarningIconImageUrl="~/etc/img/status/warning_sm.png" />
				</td> 
			</tr>
			<tr>
				<td>
					<asp:Button ID="Button_Server_Save" runat="server" Text="Save" Width="60" 
						ValidationGroup="ValidationGroup_Server_INSERT"
						OnClick="Button_Server_Save_Click" />
				</td>
			</tr>
		</table>
	</asp:Panel>
</form>
</body>
</html>

CS

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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

        }

        protected void Button_Server_Save_Click(object sender, EventArgs e)
        {
            RequiredFieldValidator1.IsValid = false;
            ModalPopupExtender_Server_New.Show();
        }
    }
}

Thanks for you assistance

Hi matt.gulick,

Based on your description and code provided, I see the ValidatorCalloutExtender not shown in the right position.

I think what caused this issue it is the css file which relative ValidatorCalloutExtender control not loaded correctly.

For this issue, I suggest you set the showing position of ValidatorCalloutExtender manually using some css code like below:

http://forums.asp.net/p/1286734/2488816.aspx#2488816

Thanks.

Best Regards.

Thanks for taking the time to reply, but the "solutions" in that post (if they would actually correct my problem) are completely unacceptable.

what is this error "AsyncFileUpload"?

Hi,

I used this ajax control in my project and my Debugger get this error

"0x800a01bd – JavaScript runtime error: Object doesn’t support this action"

this is my code:

<div class="FontFamily">
                                <div>
                                    <asp:Label runat="server" CssClass="fit">TEST</asp:Label>
                                    <div>
                                        <asp:TextBox runat="server" ID="TextBox1" CssClass="TextBox-control fit" />
                                        <%--<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
                                        CssClass="text-danger" ErrorMessage="The email field is required." />--%>
                                    </div>
                                </div>
                                <div>
                                    <div>
                                        <asp:Label runat="server" CssClass="fit">TEST</asp:Label>
                                        <div>
                                            <cc1:Editor ID="Editor1" runat="server" Width="650" Height="300" />
                                            <%--<asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
                                            CssClass="text-danger" ErrorMessage="The email field is required." />--%>
                                        </div>
                                    </div>
                                </div>
                                <div dir="ltr">
                                    <asp:Label runat="server" CssClass="fit">TEST</asp:Label>
                                    <%--<asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server"                                                                       CssClass="FontFamily" />--%>
                                    <asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnUploadedFileError="AsyncFileUpload1_UploadedFileError" />
                                </div>
                            </div>

Somethings is cool when try to upload pic in other project never get this error??????????

what is problem in this project??????????

just something you must know is this This div in side of
Update panel and this update panel shown in
ModalPopupExtender.

and used ToolkitScriptManager in master page.

plz help me THANKS.

Auto complete not working ???

.aspx page

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="ImageButton1"
                                                                PopupControlID="panelproduct" RepositionMode="RepositionOnWindowResizeAndScroll"
                                                                PopupDragHandleControlID="panelproduct">
                                                            </cc1:ModalPopupExtender>
                                                            <asp:Panel ID="panelproduct" runat="server" Width="350" BorderColor="black" BackColor="#9A9A9A">
                                                                <table style="width: 100%; border: 1px solid #000;">
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Product Name:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddproduct" runat="server"  autocomplete="off"></asp:TextBox>
                                                                            <cc1:AutoCompleteExtender ID="txtaddproduct_AutoCompleteExtender"
                                                                                runat="server" EnableCaching="true"
                                                        DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList" ServicePath=""
                                                        TargetControlID="txtaddproduct" UseContextKey="True" MinimumPrefixLength="1" ShowOnlyCurrentWordInCompletionListItem="true">
                                                                            </cc1:AutoCompleteExtender>
                                                                           <%-- <cc1:AutoCompleteExtender ID="txtaddproduct_AutoCompleteExtender" runat="server"
                                                                                EnableCaching="true" DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList"
                                                                                ServicePath="WebService.asmx" TargetControlID="txtaddproduct" UseContextKey="True"
                                                                                MinimumPrefixLength="1" ShowOnlyCurrentWordInCompletionListItem="true">
                                                                            </cc1:AutoCompleteExtender>--%>
                                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="txtaddproduct"
                                                                                ErrorMessage="*" ValidationGroup="qq"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Brand Name:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddbrand" runat="server"></asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Opening Stock:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddopeningstock" runat="server"></asp:TextBox>
                                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtaddopeningstock"
                                                                                ErrorMessage="*" ValidationGroup="qq"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Unit:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddunit" runat="server"></asp:TextBox>
                                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txtaddunit"
                                                                                ErrorMessage="*" ValidationGroup="qq"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                        </td>
                                                                        <td>
                                                                            <asp:Button ID="Button4" runat="server" Text="Add" CssClass="button_bg" OnClick="Button4_Click2"
                                                                                ValidationGroup="qq" />
                                                                            <asp:Button ID="Button5" runat="server" Text="Cancel" CssClass="button_bg" OnClick="Button5_Click1" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </asp:Panel>

.cs

  [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        DataSet ds = new DataSet();
        clsGENERAL obj = new clsGENERAL();
        string slc = "select Product from master_item where Product like '" + prefixText + "%'";
        ds = obj.SelectQuery1(slc);
        string[] items = new string[ds.Tables[0].Rows.Count];
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            items.SetValue(ds.Tables[0].Rows[i]["Product"].ToString(), i);
        }
        return items;

    }

Have you enabled pagemethods on the ScriptManager?

Hi,

Please refer to the example at:
http://forums.asp.net/p/1582937/3996380.aspx#3996380
. Any more question, please feel free to reply.

In my other page its work finnaly with modalpopupextender but in this page i got problem

[RESOLVED]Drop down does not postback within form

Hello i have a little problem on Form
Dropdownlist doesn’t postback the page..

i am using web form using masterpage

 my index.master is like this 

<form id="form1" action="" runat="server" >


<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                        
                    </asp:ContentPlaceHolder>
                        </form>

Here is my  selected registerdetail.aspx page

 Your Address</h3>
        <div class="registerbox">
            <fieldset>
                
                
                
                
                <div class="control-group">
                    <label class="control-label">
                        <span class="red">*</span>Country:</label> <asp:DropDownList ID="dropCountry" BackColor=White CssClass="libox" runat="server" OnSelectedIndexChanged="dropCountry_SelectedIndexChanged" AutoPostBack="True">
                        </asp:DropDownList>
                         
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="dropCountry" ErrorMessage="RequiredFieldValidator" ValidationGroup="ValidRegDetail"></asp:RequiredFieldValidator>
                   </div>
                 
                       <div class="controls">
&nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" />
                           </div>
                </div>
                
                <div class="control-group">
                    &nbsp;<div class="controls">
                       
                    <label for="select01" class="control-label">
                        <span class="red">*</span>City:</label><asp:DropDownList ID="dropCity" BackColor="White" runat="server" AutoPostBack="True" CssClass="libox">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="dropCity" ErrorMessage="RequiredFieldValidator" ValidationGroup="ValidRegDetail"></asp:RequiredFieldValidator>
                    </div>

Here is my selected index change event 

            lbl2.Text = "asd";
            dropCity.Items.Clear();
            cityService.GlobalWeather cityServ = new cityService.GlobalWeather();
            string result = cityServ.GetCitiesByCountry(dropCountry.SelectedItem.Text);
            XDocument xdoc = XDocument.Parse(result);
            var citys = xdoc.Descendants("Table");
            foreach (var tag in citys)
            {
                dropCity.Items.Add(tag.Element("City").Value);
            }
            Label1.Text = "asd";
            Response.Write("it is work ");

 This event only trigger when i use this button i think because it is postback page

   protected void Button1_Click1(object sender, EventArgs e)
        {
            lbl2.Text = "asd";

        }

I have to postback page without button when i selected country from dropdownlist page .
And I working on host (http://mstkacar.com/registerdetail.aspx) its my personal page.

Thanks..

Hi, You have a common validation group for both drop downs and that may be the problem. You need to post back on selecting coutnry, but you have same validation group mentioned for city drop down.

i deleted all validations still same :)

Not sure, try double click the DropDownList, type the code.
Set the action attribute in your form tag <form action="youraspname.aspx" >

<form action="youraspname.aspx" > i did  not worked thx for replies

Can you post your form tag declaration and the asp file name that you are working on?
<form id="form1" action="default.aspx" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            Current Time:
            <asp:Label ID="lblTime" runat="server" /><br />
            Session Value:
            <asp:Label ID="lblSessionValue" runat="server" /><br />
            <br />
            <asp:UpdatePanel ID="upSetSession" runat="server" EnableViewState="True">
                <ContentTemplate>
                    
                    <asp:DropDownList ID="ddlMyList" runat="server"
                        OnSelectedIndexChanged="ddlMyList_SelectedIndexChanged"
                        AutoPostBack="true">
                        <asp:ListItem>Select One</asp:ListItem>
                        <asp:ListItem>Maybe</asp:ListItem>
                        <asp:ListItem>Yes</asp:ListItem>
                    </asp:DropDownList>
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

                </ContentTemplate>
                 <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlMyList" EventName="SelectedIndexChanged" /> </Triggers>
                
            </asp:UpdatePanel>

        </div>
        <div>
            <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
            <asp:Button ID="Button2" runat="server" Text="Button"   OnClick="Button2_Click"  OnClientClick="" />

        </div>
    </form>

also i can give u skype calling teamviewer sharing im spend so many hour for this…

http://brendan.enrick.com/post/dynamically-register-an-asynchronous-postback-control-with-a-scriptmanager.aspx

Hello oned_gk it  already worked when i clicked button.
Without using the button I wanna make it shown on the page with using SelectedindexChange Event.
I trace step by step SelectedindexChange Event worked.
The only problem is that I can’t make it seen on the page!

If your event is worked and you don’t see any changes on the screen then something is not working as expected in your selected index change event. Could you share your code?
protected void ddlMyList_SelectedIndexChanged(object sender, EventArgs e)
{
Label1.Text = "içteki oldu";
Label2.Text = "dıştaki oldu";
Response.Write("oldu abicim");
Session.Remove("MyValue");
Session.Add("MyValue", this.ddlMyList.SelectedValue);
//postbacktimer
//upSetSession.Update();
//PostBack
}

if u want i share my project too  
the codes working step by step but nothing displays on the  page

Just let you know that you can’t use Response.Write during an asynchronous postback (Update Panel). Remove Response.Write line in your selectedindex event.

its work when i delete it  hallelujah !

[RESOLVED]AsyncFileUpload Control not working in Update Panel

I have a update panel which contain the AsyncFileUpload Control. when i choose any image first time with out fire any event in update panel then this control not working. but once update panel fire any event then this control start working properly can any
buddy help me in solving this problem.

Use Asp file upload  with in update panle 

http://www.c-sharpcorner.com/uploadfile/prathore/fileupload-control-in-update-panel-using-Asp-Net-ajax/

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<Triggers>

<asp:PostBackTrigger ControlID="Button1" />

</Triggers>
<ContentTemplate>

<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

</ContentTemplate>
</asp:UpdatePanel>

Ans Asnycronouse File upload in update panel

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


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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></title>


    <script type="text/javascript">
        function uploadComplete(sender, args) {
                        var filename = args.get_fileName();
                        $get("imgUpload").src = "./upload/" + filename;
        }
    </script>


</head>
<body>
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" OnClientUploadComplete="uploadComplete" OnUploadedComplete="AsyncFileUpload1_UploadedComplete" />
    <br />
    <img src="" id="imgUpload" alt="" />
    </form>
</body>
</html>

 

Cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class test7 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {        
    }
    protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
        string strPath = MapPath("~/upload/") + Path.GetFileName(e.filename);
        AsyncFileUpload1.SaveAs(strPath);
    }
}

but in this case Page is rendering but i dont want to render the page. here is my code

<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="secondWhite">
<div class="padding40px">
<asp:HiddenField ID="HiddenField2" runat="server" />
<asp:HiddenField ID="HiddenField4" runat="server" />
<div class="leftFloat">
<h1><%=Label4.Text%></h1>

</div>
<div class="rightFloat">
<a href="#" class="doneButton applynow">Apply Sorting</a>
<a id="A1" href="#" class="doneButton create" runat="server">Create</a>
<a href="#" class="buttonCancle">Delete All</a>
</div>
<div class="clear"></div>
<hr />
<asp:DataList ID="DataList1" runat="server" OnCancelCommand="DataList1_CancelCommand" OnDeleteCommand="DataList1_DeleteCommand" OnEditCommand="DataList1_EditCommand">
<ItemTemplate>
<div class="liClass">
<div class="boldContent"><%#Eval("Title")%></div>
<div class="normalContent"><%#Eval("SpecialText")%> </div>
<%–<%#If(Eval("photo") = "", "", "<img alt=” src=’http://localhost:49646/soft2Creative/UserFile/" + Eval("photo") + "’ width=’100px’/>")%>–%>
<asp:HiddenField ID="HiddenField1" runat="server" Value=’<%#Eval("id").tostring() %>’ />

<div class="underBox" align="right">
<asp:LinkButton ID="LinkButton2" runat="server" CssClass="op" CommandName="Edit" ValidationGroup="E">Edit</asp:LinkButton>

<asp:LinkButton ID="LinkButton5" CssClass="marginLeft op" runat="server" CommandName="Delete" ValidationGroup="E" OnClientClick="DeleteOver()">Delete</asp:LinkButton>
<asp:ConfirmButtonExtender
ID="ConfirmButtonExtender1" runat="server"
TargetControlID="LinkButton5"
DisplayModalPopupID="ModalPopupExtender1"
>
</asp:ConfirmButtonExtender>
<asp:ModalPopupExtender BackgroundCssClass="modalPopCss" OkControlID="LinkButton3" CancelControlID="LinkButton4" TargetControlID="LinkButton5" PopupControlID="Panel1" ID="ModalPopupExtender1" runat="server">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="panelCss" Width="500px">
<h1>Delete Confirmation</h1>
<p>Are you sure to delete this record? Once you delete this record you will never get this back.</p>
<p style="margin-top:40px; margin-left:0px; text-align:left">
<asp:LinkButton ID="LinkButton3" runat="server" CssClass="doneButton">Confirm</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server" CssClass="buttonCancle">Close</asp:LinkButton>
</p>

</asp:Panel>

</div>
</div>
<hr />
</ItemTemplate>
<EditItemTemplate>

<div class="liClass" id=’<%#Eval("id").tostring() %>’ onclick=’show(this.id)’>

<asp:RequiredFieldValidator SetFocusOnError="true" ID="RequiredFieldValidator12" ValidationGroup="CU1" Display="Dynamic" CssClass="errorControlNewDark" runat="server" ForeColor="" ErrorMessage="Title, Heading or Subject cannot be empty" ControlToValidate="TextBox11"></asp:RequiredFieldValidator>
<asp:Label ID="Label16" runat="server" CssClass="errorControlNew1" Visible="false"></asp:Label>

<asp:TextBox ID="TextBox11" MaxLength="100" Width="100%" runat="server" Text=’<%#Eval("Title") %>’ ToolTip="Title, Heading, Subject" ValidationGroup="CU1"></asp:TextBox>
<asp:TextBoxWatermarkExtender TargetControlID="TextBox11" WatermarkCssClass="waterMark" WatermarkText="Title, Heading, Subject in About 100 Characters" ID="TextBoxWatermarkExtender11" runat="server">
</asp:TextBoxWatermarkExtender>
<asp:TextBox ID="TextBox12" runat="server" Width="100%" TextMode="MultiLine" Text=’<%#Eval("Des") %>’ MaxLength="200" ToolTip="Description" ></asp:TextBox>
<asp:TextBoxWatermarkExtender TargetControlID="TextBox12" WatermarkCssClass="waterMark" WatermarkText="Description" ID="TextBoxWatermarkExtender12" runat="server">
</asp:TextBoxWatermarkExtender>

<asp:TextBox ID="TextBox13" Columns="200" Width="100%" runat="server" Text=’<%#Eval("SpecialText") %>’ TextMode="MultiLine" ToolTip="Special Highlight Text"></asp:TextBox>

<p class="tempText"><span class="lblCharLeft"></span></p>
<asp:TextBoxWatermarkExtender TargetControlID="TextBox13" WatermarkCssClass="waterMark" WatermarkText="Special Highlight text (Optional)" ID="TextBoxWatermarkExtender13" runat="server">
</asp:TextBoxWatermarkExtender>

<div class="marginBottom20"></div>
<p class="tempText">Select Image</p>

<div class="underBox" align="right">
<asp:LinkButton ID="LinkButton11" runat="server" ValidationGroup="CU1" OnClick="LinkButton1_Click" >Update</asp:LinkButton>
<asp:LinkButton ID="LinkButton6" CssClass="marginLeft" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
</div>
</div>
<hr />
</EditItemTemplate>
</asp:DataList>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<div class="rightPanel width400">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<h1><asp:Label ID="Label4" runat="server" Text="Create"></asp:Label></h1>
<p class="tempText marginBottom20">Please Enter the following Detail.</p>
<asp:HiddenField ID="HiddenField3" runat="server" />

<asp:Label ID="Label6" runat="server" CssClass="errorControlNew" Visible="true"></asp:Label>

<asp:TextBox ID="TextBox1" MaxLength="100" Width="100%" runat="server" ToolTip="Title, Heading, Subject" ValidationGroup="CU"></asp:TextBox>
<asp:TextBoxWatermarkExtender TargetControlID="TextBox1" WatermarkCssClass="waterMark" WatermarkText="Title, Heading, Subject in About 100 Characters" ID="TextBoxWatermarkExtender1" runat="server">
</asp:TextBoxWatermarkExtender>

<asp:TextBox ID="TextBox2" runat="server" Width="100%" TextMode="MultiLine" MaxLength="200" ToolTip="Description" ></asp:TextBox>
<asp:TextBoxWatermarkExtender TargetControlID="TextBox2" WatermarkCssClass="waterMark" WatermarkText="Description" ID="TextBoxWatermarkExtender2" runat="server">
</asp:TextBoxWatermarkExtender>

<asp:TextBox ID="TextBox3" Columns="200" Width="100%" runat="server" TextMode="MultiLine" ToolTip="Special Highlight Text"></asp:TextBox>

<p class="tempText"><span class="lblCharLeft"></span></p>
<asp:TextBoxWatermarkExtender TargetControlID="TextBox3" WatermarkCssClass="waterMark" WatermarkText="Special Highlight text (Optional)" ID="TextBoxWatermarkExtender3" runat="server">
</asp:TextBoxWatermarkExtender>

<div class="marginBottom20"></div>
<p class="tempText">Select Image</p>
<asp:AsyncFileUpload OnClientUploadComplete="uploadComplete" runat="server" ID="AsyncFileUpload1"
Width="400px" UploaderStyle="Traditional" CompleteBackColor="White" UploadingBackColor="#CCFFFF"
ThrobberID="imgLoader" OnUploadedComplete="FileUploadComplete" OnClientUploadStarted = "uploadStarted"/>
<asp:Image ID="imgLoader" runat="server" ImageUrl="~/Image/loader.gif" /><br /><br />
<img id = "imgDisplay" alt="" src="" style = "display:none"/>
<p style="margin-top:10px; margin-left:0px; text-align:right"><asp:LinkButton ID="LinkButton1" CssClass="doneButton" runat="server" ValidationGroup="CU" OnClick="LinkButton1_Click" >Save</asp:LinkButton>
<a href="#" class="buttonCancle delete" id="c1">Cancle</a>
</p>
</ContentTemplate>
</asp:UpdatePanel>
<div>

</div>
</div>

Hello

AsyncFileUpload may not behave expectedly in UpdatePanel. Some users ended with changing the form markup to

enctype="multipart/form-data" method="post"

See if this can work in your case.

Alternatively, If you do not mind javascript libraries. You can try jQuery file upload plugins. for your reference,

http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery

[RESOLVED]AutoComplete does not work !

Hi all,

I’ve just started using AjaxControlToolkit (which is amazing IMO). I’m trying to apply AutoCompleteExtender into my web but it does NOT work.

I have the following service:

[WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    
    [System.Web.Script.Services.ScriptService]
    public class BranchAutoComplete : System.Web.Services.WebService
    {
        [System.Web.Services.WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public string[] GetBranchesForBlotter(string prefixText, int count)
        {
            return SqlWorker.BlotterRetrieveBranches(prefixText);
        }
    }

In my Webpage:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">        
        <Services>
            <asp:ServiceReference Path="BranchAutoComplete.asmx" />
        </Services>
    </asp:ToolkitScriptManager>


<asp:TextBox ID="txtCounterParty" runat="server"  />    
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="(*)" ForeColor="Red" ControlToValidate="txtCounterParty"></asp:RequiredFieldValidator>
<asp:AutoCompleteExtender ID="autoCompleteBranchList" runat="server" TargetControlID="txtCounterParty" 
	ServicePath="BranchAutoComplete.asmx" ServiceMethod="GetBranchesForBlotter" FirstRowSelected="true" 
        DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true"
        MinimumPrefixLength="1" CompletionSetCount="20" CompletionInterval="1000" EnableCaching="true">
</asp:AutoCompleteExtender>

Please let me know what I have to do to resolve this issue??? Thanks very much.

Note: the function SqlWorker.BlotterRetrieveBranches(prefixText) works properly.

please make sure your web service path is correct

I put them in the same folder. I don’t know if the name space will place role in this problem?

Please download the demo program and check that these program created by me only for your help

https://skydrive.live.com/?lc=24841#cid=2F22272220E37707&id=2F22272220E37707%21103

Program name =AutoCompletejQueryASP

 Program name= AutoCompleteFastExample