ASP.NET - how to create a popup in a popup in asp.net

Asked By chandana
30-Aug-11 07:09 AM
Hi..
i need to create a popup in a popup using asp.net with c#
is that possible..
pls help me..
  Ravi S replied to chandana
30-Aug-11 07:13 AM
HI

Popup 2 of nested popups




refer
http://www.codeproject.com/KB/ajax/NestedPopup.aspx
  dipa ahuja replied to chandana
30-Aug-11 07:14 AM
Using JavaScript simple alert box :

Page.RegisterClientScriptBlock("""<script>alert('Book Added');</script>");
 
 
Response.Write("<script>alert('Book Added')</script>");

Or you can display your own window by using the modalpopupExtender:


CSS Effect
------------
<style type="text/css">
  .modalBackground
  {
  background-color#CCCCFF;
  filteralpha(opacity=40);
  opacity0.5;
  }
  .ModalWindow
  {
  bordersolid1px#c0c0c0;
  background-color#99ccff;
  padding0px10px10px10px;
  positionabsolute;
  top-1000px;
  }
</style>
ModapPopUp Code
------------------------
<cc1:ModalPopupExtender TargetControlID="Button2" BackgroundCssClass="modalBackground"
CancelControlID="btnMsg" PopupControlID="Panel1" PopupDragHandleControlID="btnMsg"
ID="ModalPopupExtender2" runat="server">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="ModalWindow">
<%--Button popup--%>
<center>
<table runat="server">
<tr>
  <td bgcolor="#cccccc" style="border1pxborder-colorBlack;" height="20px" align="left"
  valign="top">
  <div style="border-bottom-width1pxborder1px solid">
  Deletion</div>
  </td>
</tr>
<tr>
  <td align="center" bgcolor="#99ccff">
  <br />
  The Record has been deleted!
  </td>
</tr>
</table>
<asp:Button ID="btnMsg" runat="server" Text="OK" /><br />
<br />
</center>
</asp:Panel>
<br />
<asp:Button ID="Button2" runat="server" Text="OK" /><br />

  Reena Jain replied to chandana
30-Aug-11 07:17 AM
hi,

try this and let me know


<asp:Linkbutton ID="lnk" NavigateUrl="~/YourPage.aspx" runat="server" Text="click" ></asp:Linkbutton>

or in your C# client side code (event):
RegisterStartupScript("SomeNameForThisScript", "window.open('YourPage.aspx');");

When you page is served up, the startup script will fire and open a new window.

Hope this will help you
  TSN ... replied to chandana
30-Aug-11 07:17 AM
hi..

you can use ajax modal popup extender


For this to work u need to download and install http://ajaxcontroltoolkit.codeplex.com/

Create a new website in visual studio and write html markup of aspx page as shown below.

Put AjaxControlToolkit.dll in BIN folder and register assembly in page directive of ur aspx page.

<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

Now in Head section of page add this javascript method

<script type="text/javascript">

function MouseHover()
{
$find("modelPopupExtender1").show();
}

</script>

The complete HTML source of page will look like this
<%@ Page Language="C#" AutoEventWireup="true"  
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ 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>Ajax Model PopUp Extender With MouseOver Example</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">

        function MouseHover() 
     {
         $find("modelPopupExtender1").show();
     }
  
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
<ajaxToolkit:ToolkitScriptManager ID="toolKitScriptManager1" 
                                  runat="server">
</ajaxToolkit:ToolkitScriptManager>    
<p style="background-color: #9999FF; width: 95%;">
     
Example of using a ModalPopupExtender with with Mouse Over
<br/></p><br/>
Hover over the hyperlink 
<asp:HyperLink ID="HyperLink1" runat="server" 
               onmouseover="MouseHover();" 
               Font-Underline="True" ForeColor="Blue">
<b>Mouse Over Here to Open PopUp</b>
</asp:HyperLink> to open pop up
            
<ajaxToolkit:ModalPopupExtender runat="server" 
                   BehaviorID="modelPopupExtender1" 
                   TargetControlID="HyperLink1"
                   PopupControlID="popUpPanel" 
                   OkControlID="btnOk" 
                   BackgroundCssClass="modalBackground" >
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="popUpPanel" runat="server" 
           CssClass="confirm-dialog">
<div class="inner">
<h2>
Thanks For Visiting This Site</h2>
<div class="base">
<asp:Button ID="btnOk" runat="server" Text="Ok"/>
<asp:LinkButton ID="LinkButton1" runat="server" 
                CssClass="close" 
OnClientClick="$find('modelPopupExtender1').hide(); return false;"/>
</div></div>
</asp:Panel>
            
                  
            
    </div>
    </form>
</body>
</html>
  James H replied to chandana
30-Aug-11 07:19 AM
Hello,

Here is simple example for modalpopup asp.net ajax I have just displayed some server side control in that modal popup


<form id="form1" runat="server">
<asp:scriptmanager id="1" runat="Server"></asp:scriptmanager>
   <div>
   <asp:HyperLink ID="link1" runat="Server" Text="popup" />
   <asp:Panel ID="popup" runat="server" Style="display: none;">
     <asp:Label ID="lbl1" runat="server" Text="First Name" />
     <asp:TextBox ID="fname" runat="server" />
   </asp:Panel>
   </div>
   <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="link1" PopupControlID="popup">
   </asp:ModalPopupExtender>
   </form>


Let me know if you want some more on this.
  Riley K replied to chandana
30-Aug-11 08:20 AM
You can use JavaScript Window.Open for popup

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
  newwindow=window.open(url,'name','height=200,width=150');
  if (window.focus) {newwindow.focus()}
  return false;
}
  
// -->
</script>
 
On link click the above popup will open
 
<a href="popupex.html" onclick="return popitup('popupex.html')"
  >Link to popup</a>


Regards
  Vickey F replied to chandana
30-Aug-11 09:04 AM

If you want to show popup then use jquery popup.

after adding jqueryui plugin you can use it.

like this-

<script>

function funShow() {

$('#dialog).dialog({ resizable: false, height: 140, modal: true });

}
</script>

<div id="dialog" title="Basic dialog">hi
</div>

 

<asp:Button runat="server" Text="Button" onClientClick="return funShow()" />

FOR EXAMPLE FOLLOW THIS

-http://jqueryui.com/demos/dialog/

Create New Account
help
in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page. %@ Page Language = ”vb” trace = ”true”AutoEventWireup = ”false” Codebehind = ”WebForm1.aspx.vb” Inherits = ”WebApplication2.WebForm1?&gt; 2
difference between registerclientscriptblock and registerstartupscript what is the difference between registerclientscriptblock and registerstartupscript. . .? what is use @ what time RegisterClientScriptBlock is for returning blocks of client-side script containing functions. RegisterStartupScript is for returning blocks of client-script not packaged in functions-in other words, code that's to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control = "MyControl.ascx" %> Hi
how to show messagebox in asp.net 2.0 c# hi frndz, i want the coding for creating messagebox in asp.net2 Bytes has all the answers!" ) } } http: / / www.c-sharpcorner.com / UploadFile / mahesh / WebMsgBox09082006110929AM / WebMsgBox.aspx Page Dimmer The first thing that you will need to do is make the page content unaccessible, by this I mean once your message box is displayed, your user will not be able to click on any navigations links on your page without acknowledging the message box . This is where the page dimmer comes in. The page dimmer is simply a div element with a fixed position. What this does is place a div element over your page content. If you were to set the background color of the div, then your page
what is the difference between registerclientscriptblock and registers what is the difference between registerclientscriptblock and registerstartupscript RegisterClientScriptBlock inserts the script immediately following the <form> start tag whereas RegisterStartupScript adds the script immediately before the < / form> end tag. In IE the HTML DOM is blocks) your controls such as textboxes etc in your form will be created, then your RegisterStartupScript will be parsed (and executed if not in function blocks). So, in IE at least elements will exist for your scripts to access if you put the code in the RegisterStartupScript. Conversely, you are basically guaranteed that any form elements will not exist for your scripts javascript / "> " + "function a(){window.alert( document.form[0].txtElement.value );}" + "< / script> " ); Code Snip-it 3: RegisterStartupScript( "CS3", "<script language = / "javascript / "> " + "window.alert( document.form[0].txtElement.value );" + "< / script> " ); Code Snip-it
to show popup window or alert box message using java script on button click. . in asp.net c# just like i have add book form when user click on add button. . if result from the code behind and conditionally placing the below lines on successful save. . VB Page.ClientScript.RegisterClientScriptBlock( Me .GetType, "jcr" , "alert('Data Saved Successfully')" , True ) C# Page.ClientScript.RegisterClientScriptBlock( this .GetType, "jcr" , "alert('Data Saved Successfully');" , True ) refer http: / / www.eggheadcafe.com / community / aspnet probably the most common scenario; you have a simple button that, when clicked, posts the page back to the server where some logic is performed. But before the postback occurs, you many situations where this can be used: in a shopping cart on the "Finalize Order" page to ask if the user really wants to order the goods. Or on a forum