UpdatePanel,ModalPopupExtender,ValidatorCalloutExtender can.t be work together???

Last post 04-02-2007 6:03 AM by dragonsuc. 2 replies.

Sort Posts:

  • UpdatePanel,ModalPopupExtender,ValidatorCalloutExtender can.t be work together???

    04-01-2007, 11:57 PM
    • Loading...
    • dragonsuc
    • Joined on 04-01-2007, 11:43 PM
    • Posts 3

    this  is .aspx :

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


    <!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>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
          <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True" />
        <div>
          
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server">
                    <div class="demoarea">
           
                 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                     <div >
                <asp:LinkButton ID="lbtnAdd"  runat="server"   CausesValidation="false"  OnClick="lbtnAdd_Click">NewAdd</asp:LinkButton>
                <asp:LinkButton ID="LinkButton1"   style="display:none;" runat="server" >LinkButton</asp:LinkButton>
                </div>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                      <div>
             <asp:Panel ID="Panel1" runat="server" Style="display: none"    Width=300 Height=200 BackColor="LightGray"  CssClass="modalPopup" >
              <asp:Panel  Width=100% ID="Panel3" runat="server" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black">
                    <div>
                        <p></p>
                    </div>
              </asp:Panel>
                    <div align=center >
               <p>
                            <label class="sampleStyleB">name</label><asp:TextBox ID="txtName"  CssClass=sampleStyleB  runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator runat="server" ID="NReq" ControlToValidate="txtName" ErrorMessage="<b>Required Field Missing</b><br />A name is required." Display="None" />
                            <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="NReqE"  TargetControlID="NReq"    HighlightCssClass="validatorCalloutHighlight" />
                        </p>
                         <p>
                           <label class="sampleStyleB">code</label><asp:TextBox ID="txtCode"  CssClass=sampleStyleB  runat="server"></asp:TextBox><asp:TextBox ID="txtID"   Width=0 Visible=false CssClass=sampleStyleB  runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtAddOrEdit" runat="server" CssClass="sampleStyleB" Visible="false"
                                Width="0"></asp:TextBox></p>
                        <p>
                           <label  class="sampleStyleB" >memo</label><asp:TextBox ID="txtRemarks" CssClass=sampleStyleB runat="server"></asp:TextBox>
                        </p>
                        <p> </p>
                        <p style="text-align: center;">
                            <asp:Button CssClass=sampleStyleB ID="OkButton" runat="server" Text="ok"  Width=80 OnClick="OkButton_Click"    />
                            <asp:Button CssClass=sampleStyleB ID="CancelButton" runat="server"  CausesValidation="false"  Text="Cancel" Width =80 OnClick="CancelButton_Click" />
                        </p>
                    </div>
            </asp:Panel>
           
            </div>        
                           <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server"
                TargetControlID="LinkButton1"
                PopupControlID="Panel1"
                BackgroundCssClass="modalBackground"
              
                BehaviorID ="OkButton"
                CancelControlID="CancelButton"
                DropShadow="false"
                PopupDragHandleControlID="Panel3" />
                </ContentTemplate>
                <Triggers>
                   
                    <asp:AsyncPostBackTrigger ControlID ="OkButton" EventName ="Click" />
                </Triggers>
            </asp:UpdatePanel>            
     
    </div>
                   </asp:PlaceHolder>
            &nbsp;
          
      
       
        </div>
        </form>
    </body>
    </html>

     this is 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 Default5 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void lbtnAdd_Click(object sender, EventArgs e)
        {
            ModalPopupExtender.Show();
        }
        protected void CancelButton_Click(object sender, EventArgs e)
        {

        }
        protected void OkButton_Click(object sender, EventArgs e)
        {
            this.TextBox1.Text = this.txtName.Text;
        }

    }

     when  I   click LinkButton "lbtnAdd"  ,I can see javascipt wrong with IE  ,why ??

     

  • Re: UpdatePanel,ModalPopupExtender,ValidatorCalloutExtender can.t be work together???

    04-02-2007, 3:19 AM

    I too encountered with the same problem and I successfully managed coming out of that by using.

    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="ajax" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

    after the <%@Page directive tag and changing all the tags for ajax to <ajax:Scriptmanager....../> and <ajaxToolkit:MaskedEditValidator...../>

    Try it out, this is a problem that most of us face and this could be an easy way out. 

    Karthik Muthuswamy
    Programmer Analyst
    Chennai
  • Re: UpdatePanel,ModalPopupExtender,ValidatorCalloutExtender can.t be work together???

    04-02-2007, 6:03 AM
    • Loading...
    • dragonsuc
    • Joined on 04-01-2007, 11:43 PM
    • Posts 3

       no , this code when i  remove  updatepanel ,it will be right .

     if you  run the code,you  will see it

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter