i want to show all my warning message and error message in the modelpop extender How i can do this here is my aspx and code behind file code. please help me out how i can do call modelpopup if only if there is any error message in my web application. right
now my code is not checking if a condition is true in the or not.
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int a = 2;
if (a == 1) {
// No Modelpup
}
else if (a == 2) {
//Error Message shows in model popup
}
}
}
shahid.majee...
Member
620 Points
547 Posts
how to call model-popup extender when i press button and specific condition true
Apr 14, 2012 07:59 PM|LINK
Hi,
i want to show all my warning message and error message in the modelpop extender How i can do this here is my aspx and code behind file code. please help me out how i can do call modelpopup if only if there is any error message in my web application. right now my code is not checking if a condition is true in the or not.
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %> <%@ 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> <link href="Styles/Default.css" rel="stylesheet" type="text/css" /> <script src="script.js" type="text/javascript"></script> </head> <body> <form id="form1" runat="server"> <div style="min-height: 700px;"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Button ID="Button1" runat="server" Text="Click here to show the modal" onclick="Button1_Click" /> <asp:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="ModalPopupBG" runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" TargetControlID="Button1" PopupControlID="Panel1" Drag="true" PopupDragHandleControlID="PopupHeader"> </asp:ModalPopupExtender> <div id="Panel1" style="display: none;" class="popupConfirmation"> <div class="popup_Container"> <div class="popup_Titlebar" id="PopupHeader"> <div class="TitlebarLeft">Popup Headeright"></div> </div> <div class="popup_Body"> <p> This is a simple modal dialog </p> </div> <div class="popup_Buttons"> <input id="btnOkay" value="Done" type="button" /> <input id="btnCancel" value="Cancel" type="button" /> </div> </div> </div> </div> </form> </body> </html>Code Behind File
using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { int a = 2; if (a == 1) { // No Modelpup } else if (a == 2) { //Error Message shows in model popup } } }Shahid Majeed
Email: shahid.majeed@gmail.com
rakesh.sawan...
Member
168 Points
172 Posts
Re: how to call model-popup extender when i press button and specific condition true
Apr 15, 2012 07:37 AM|LINK
i think instead of <div id="panel1" ..
you should use <asp:panel id="panel1" with runat="server"
and in codebehind just write
ModalPopupExtender1.show(); whenever you want to show popup