Click here to Skip to main content
13,147,956 members (68,854 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Im trying to follow a article from code project regarding of placing a required field validator in a modal popup:In my master page i have the following code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en">
<head runat="server">
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <link rel="icon" type="image/ico" href="favicon.ico"/>
    <link rel="shortcut icon" href="favicon.ico"/>
     <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    <form runat="server">
    <asp:ScriptManager ID="scriptMgr" runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                    <asp:Image ID="Image1" runat="server" BorderStyle="Double" Height="49px"
                        ImageAlign="Left" ImageUrl="~/FNU_logo.jpg" style="margin-left: 0px; margin-top: 5px;"
                        Width="206px" />
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RECORDS MANAGEMENT
            <div class="clear hideSkiplink">
            <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
                    EnableViewState="False" IncludeStyleBlock="False" Orientation="Horizontal"
                    BackColor="#F7F6F3" DynamicHorizontalOffset="2" Font-Names="Verdana"
                    Font-Size="0.8em" ForeColor="#7C6F57" StaticSubMenuIndent="10px">
                    <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
                    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                    <DynamicMenuStyle BackColor="#F7F6F3" />
                    <DynamicSelectedStyle BackColor="#5D7B9D" />
                        <asp:MenuItem NavigateUrl="~/Default2.aspx" Text="File Records"/>
                        <asp:MenuItem NavigateUrl="~/ViewRecords.aspx" Text="View Recods"/>
                     <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
                    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                    <StaticSelectedStyle BackColor="#5D7B9D" />
                      <div class="main">

            <asp:ContentPlaceHolder ID="MainContent" runat="server">
                <div style="width: 1066px; height: 463px; margin-left: 0px">


                    <br />
                    <br />
                    <br />

                &nbsp;<br />
                    <br />
                    <asp:UpdatePanel ID="update" runat="server" UpdateMode="Conditional">
                            <asp:Panel ID="errorsPanel" runat="server" Style="display: none;  border-style:solid;
                    border-width: thin; border-color: #FFDBCA" Width="175px" BackColor="White">
                             <div style="text-align: left">
                                <asp:ValidationSummary ID="valSummary" runat="server" DisplayMode="BulletList" ShowSummary="true"
                            ValidationGroup="valGroup" />
                            <div style="text-align: right">
                            <asp:Button ID="okBtn" runat="server" Text="Ok" /></div>
                              <asp:Label ID="invisibleTarget" runat="server" Style="display: none" />
                            <asp:ModalPopupExtender ID="modalPopupEx" runat="server" PopupControlID="errorsPanel"
                    TargetControlID="invisibleTarget" CancelControlID="okBtn" BackgroundCssClass="HellowWorldPopup">


    <div class="footer">
        CopyRight@Fiji National University</div>

then in my master code behind i have:

public partial class SiteMaster : System.Web.UI.MasterPage
    protected void Page_Load(object sender, EventArgs e)
        if(!HttpContext.Current.User.Identity.IsAuthenticated )
   public String ValidationGroup
        { valSummary.ValidationGroup = value; }
    public bool CheckErrors()
        if (!Page.IsValid)
            return false;
        return true;


Then from another web form i trying to validate a textbox like this:

protected SiteMaster PageMaster
           return this.Master as SiteMaster;
           //return this.Site as SiteMaster;
   protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
       //SiteMaster master = (SiteMaster)this.Master;
       if (PageMaster.CheckErrors())


The problem is that the validations only occurs at the server side and no popup appears at the client end...Where do im doing something wrong and how can i show up the popup

Posted 19-Sep-12 10:43am
biswarup88 20-Sep-12 3:23am
if you want to display modalpopup just click a button write
into that event.
BillWoodruff 24-Sep-12 8:53am
Please tag your question with 'ASP.NET'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100