Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problem With Ajax Modal Pop up Extender

$
0
0

I have taken a button control on my page, click which the page would show a pop up window. On that popup window, there is a 'ok' button, clicking which it would redirect you to another page. I have done it with ajax modal pop up extender. It is showing the pop up window, but it's not getting redirected to the next page. please correct my code:
 
here is the .aspx.cs code:
 

<div class="pre-action-link" id="premain0" width="100%"> Collapse | Copy Code</div>
<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="DemoAjaxModalPopUp.aspx.cs" Inherits="DemoAjaxModalPopUp"%><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit"%> <asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server"><linkhref="../Shopping Cart Pages/ShopStyles/StyleSheet.css"rel="stylesheet"type="text/css"/><scripttype="text/javascript">var styleToSelect;function onOk() {$get('Paragraph1').className = styleToSelect;
        } function pageLoad() {$addHandler($get("showModalPopupClientButton"), 'click', showModalPopupViaClient);$addHandler($get("hideModalPopupViaClientButton"), 'click', hideModalPopupViaClient);
        } function showModalPopupViaClient(ev) {
            ev.preventDefault();var modalPopupBehavior = $find('programmaticModalPopupBehavior');
            modalPopupBehavior.show();
        } function hideModalPopupViaClient(ev) {
            ev.preventDefault();var modalPopupBehavior = $find('programmaticModalPopupBehavior');
            modalPopupBehavior.hide();
        } function HideModalPopup() {$find("programmaticPopup").hide();
        } function setBodyHeightToContentHeight() {
            document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px";
        }
        setBodyHeightToContentHeight();$addHandler(window, "resize", setBodyHeightToContentHeight);    </script></asp:Content><asp:ContentID="Content3"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server"><ajaxtoolkit:toolkitscriptmanagerrunat="server"ID="ScriptManager1"/><pid="Paragraph1"></p> <ajaxToolkit:ModalPopupExtenderrunat="server"ID="programmaticModalPopup"BehaviorID="programmaticModalPopupBehavior"TargetControlID="hiddenTargetControlForModalPopup"PopupControlID="programmaticPopup"BackgroundCssClass="modalBackground"RepositionMode="RepositionOnWindowScroll"OkControlID="OkButton"DropShadow="true"PopupDragHandleControlID="Panel3"></ajaxToolkit:ModalPopupExtender> <asp:Buttonrunat="server"ID="hiddenTargetControlForModalPopup"Style="display: none"/> <asp:PanelID="programmaticPopup"runat="server"CssClass="modalPopup"Style="display: none; width: 350px; padding: 10px"><asp:PanelID="Panel3"runat="server"Style="cursor: move; background-color: #DDDDDD;
                border: solid 1px Gray; color: Black"><divclass="align_center"><h3> Login Success</h3><hr/></div></asp:Panel><divclass="align_center"><p>
                    You have successfully Logged in.</p><pclass="align_center"><asp:ButtonID="OkButton"runat="server"Text="OK"OnClientClick="return HideModalPopup();"OnClick="OkButton_Click"/></p></div></asp:Panel> <asp:PanelID="Panel4"runat="server"CssClass="style48"Height="148px"><asp:ButtonID="Button_Fire"runat="server"Text="Show Pop Up and then redirect to another page"CssClass="style49"Height="59px"Width="453px"onclick="Button_Fire_Click"/></asp:Panel></asp:Content> 

 
here is the .aspx code
 

<div class="pre-action-link" id="premain1" width="100%"> Collapse | Copy Code</div>
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls; publicpartialclass DemoAjaxModalPopUp : System.Web.UI.Page
{protectedvoid Page_Load(object sender, EventArgs e)
    { 
    } protectedvoid showModalPopupServerOperatorButton_Click(object sender, EventArgs e)
    {this.programmaticModalPopup.Show();
    }protectedvoid hideModalPopupViaServer_Click(object sender, EventArgs e)
    {this.programmaticModalPopup.Hide();
    } protectedvoid OkButton_Click(object sender, EventArgs e)
    {
        Response.Redirect("DemoJoin.aspx");
    }protectedvoid Button_Fire_Click(object sender, EventArgs e)
    {
        programmaticModalPopup.Show();
    }
}

Viewing all articles
Browse latest Browse all 5678

Trending Articles