ModalPopupExtender and validation problems

Posted by Malachi on Stack Overflow See other posts from Stack Overflow or by Malachi
Published on 2009-09-23T13:35:49Z Indexed on 2010/04/26 15:43 UTC
Read the original article Hit count: 773

Filed under:
|
|

The problem I am facing is that when there is validation on a page and I am trying to display a model pop-up, the pop-up is not getting displayed. And by using fire-bug I have noticed that an error is being thrown.

The button that is used to display the pop-up has cause validation set to false so I am stuck as to what is causing the error.

I have created a sample page to isolate the problem that I am having, any help would be greatly appreciated.

The Error

function () {Array.remove(Page_ValidationSummaries, document.getElementById("ValidationSummary1"));}(function () {var fn = function () {AjaxControlToolkit.ModalPopupBehavior.invokeViaServer("mpeSelectClient", true);Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);}) is not a function
http://localhost:1131/WebForm1.aspx
Line 136

ASP

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="CLIck10.WebForm1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!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:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <asp:Button ID="btnPush" runat="server" Text="Push" CausesValidation="false" onclick="btnPush_Click" />
            <asp:TextBox ID="txtVal" runat="server" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtVal" ErrorMessage="RequiredFieldValidator" />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" />



        <asp:Panel ID="pnlSelectClient" Style="display: none" CssClass="box" runat="server">
        <asp:UpdatePanel ID="upnlSelectClient" runat="server">
            <ContentTemplate>
                <asp:Button ID="btnOK" runat="server" UseSubmitBehavior="true" Text="OK" CausesValidation="false" OnClick="btnOK_Click" />
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false" OnClick="btnCancel_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
        </asp:Panel>

        <input id="popupDummy" runat="server" style="display:none" />

        <ajaxToolkit:ModalPopupExtender ID="mpeSelectClient" runat="server" 
        TargetControlID="popupDummy"
        PopupControlID="pnlSelectClient" 
        OkControlID="popupDummy"
        BackgroundCssClass="modalBackground" 
        CancelControlID="btnCancel" 
        DropShadow="true"  />   
    </div>
</form>

Code Behind

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

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

        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            mpeSelectClient.Hide();
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            mpeSelectClient.Hide();
        }

        protected void btnPush_Click(object sender, EventArgs e)
        {
            mpeSelectClient.Show();
        }
    }
}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about AJAX