ASP.NET - Pop Up window in asp.net

Asked By Aksara L.P
21-Jul-11 07:47 AM
Pop Up window in asp.net
  dipa ahuja replied to Aksara L.P
21-Jul-11 07:49 AM
You can create popup using the Ajax's modalpopupExtender

 <asp:Panel ID="panEdit" BackColor="White" Width="300" runat="server" CssClass="ModalWindow">
    <%--Button popup--%><br />
    <center>Login Detail<br /><br />
    Username:
    <asp:TextBox BackColor="#ffff99" ID="txtuname" runat="server"></asp:TextBox><br />
    Password:
    <asp:TextBox BackColor="#ffff99" ID="txtpwd" TextMode="Password" runat="server"/><br /><br />
    <asp:Button CssClass="btn" ID="Button2"
      runat="server" Text="Check" OnClick="BtnLogin_Click" />
    <asp:Button CssClass="btn" ID="btnMsg" runat="server" Text="calcel" /><br />
    <br /><br />
    </center>
  </asp:Panel>

CSS
   <style type="text/css">  
  .btn
  {
    border-stylesolid;
    border-bottom-width1px;
    border-bottom-colorBlack;
    
  }
  .modalBackground
  {
    background-colorGray;
    filteralpha(opacity=40);
    opacity0.5;
  }
  .ModalWindow
  {
    bordersolid1px#c0c0c0;
    background-colorSilver;
    border-width2px;
    border-colorBlack;
    border-stylesolid;
    padding0px10px10px10px;
    positionabsolute;
    top-1000px;
  }
  </style>

  Vickey F replied to Aksara L.P
21-Jul-11 07:51 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/

 

  Reena Jain replied to Aksara L.P
21-Jul-11 07:54 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
  dipa ahuja replied to Aksara L.P
21-Jul-11 07:55 AM
sorry forget the modalpopup

  <cc1:ModalPopupExtender TargetControlID="Button1" BackgroundCssClass="modalBackground"
      CancelControlID="btnMsg" PopupControlID="panEdit" PopupDragHandleControlID="btnMsg"
      ID="ModalPopupExtender1" runat="server">
    </cc1:ModalPopupExtender>
  Riley K replied to Aksara L.P
21-Jul-11 08:55 AM

You can do it by using javascript.


Say your popup page name is 'ForgotPassword.aspx'

and your button id is 'btnGo'

 

<script language="javascript">
 
 
    function OpenForgotPassword()
 {
  strUrl="ForgotPassword.aspx";
  x = window.showModalDialog(strUrl,"newwin","dialogHeight:20;dialogWidth:36; status:No; edge:Raised; center:yes; help:No; resizable:No; ")
 }
</script>
 
 
.aspx.cs page coding
    
protected void Page_Load(object sender, EventArgs e)
    
 {
      
  btnGo.Attributes.Add("onclick","return OpenForgotPassword();");
 
      
 }

  Radhika roy replied to Aksara L.P
21-Jul-11 10:17 AM
you can use Javascript popup.
for this you have to use Window.open() method.


use this code-

<script type="text/javascript">
Function OpenPopup() {
    window.open("popup.aspx","List","scrollbars=no,resizable=no,width=400,height=280");
    return false;
}
</script>

<asp:Button ID="Button1" runat="server" Text="Show List"  onClientClick="OpenPopup()"/>

Hope this will help you.
Create New Account
help
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 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 In the code below I am adding the attributes in the Page_Load method of the page, but of course you can add this code to other locations in your code as well: C# private void Page_Load(object sender, System.EventArgs e) { btnDoSomething.Attributes.Add("onclick", "return confirm('Are you sure you want to do this
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 In the code below I am adding the attributes in the Page_Load method of the page, but of course you can add this code to other locations in your code as well: C# private void Page_Load(object sender, System.EventArgs e) { btnDoSomething.Attributes.Add("onclick", "return confirm('Are you sure you want to do this VB.NET Private Sub Page_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load btnDoSomething.Attributes.Add("onclick", _ "return confirm('Are you sure you want to do this');") End Sub When you compile this code, and run the page the button will now ask for confirmation when it's clicked. When you press OK the page will be submitted to the server, causing a postback. If you cancel, nothing happens and the page stays as it was. If you look at the resulting HTML in the browser, this
want session time out code? i wnt code for session time in java script using asp.net . . i want extant session time . . if one user working than extant session time otherwise close 95002 http: / / radio.javaranch.com / pascarello / 2005 / 10 / 25 / 1130246930301.html http: / / javascript.internet.com / page-details / session-time-out.html Hope it helps • Public Function KeepAlive() As String • • Dim int_MilliSecondsTimeOut Default session timeout is 20min. 20 * 5 = 100 mins. Which is good for non-secure page. Then On the pages where I want to prevent Session Timeout I entered this line. • Protected Sub Page_Load( ByVal sender As Object , ByVal e As System.EventArgs) Handles Me .Load • Try • 'dont forget to add this line Page.ClientScript.RegisterClientScriptBlock( Me . GetType , "reconn key" , KeepAlive()) • • If Not Page.IsPostBack Then • - -- • - -- • - -- • End If • • Catch eX as Exception • '- -- - • End Try • End Sub • < %@ Page Language = "vb" AutoEventWireup = "false" % > • • < %@ OutputCache Location = "None" VaryByParam = "None" % > • • <!DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML
Preventing Multiple Logins in ASP.NET I have read an article here for ( Preventing Multiple Logins in ASP.NET By Peter A. Bromberg, Ph.D.) but I still have some questions: in my web user id = sa;password = letmein" the sqlConnectionString shelll I put the same < connectionStrings > for my page? and In my page I have a company ID and BrachID and Passwrod so. . how I can setup my design whether you can depend on cache or other options described over here. . http: / / forums.asp.net / t / 1196897.aspx will fire for each request handled by ASP.NET for this application
to work. It is still not getting focus. Here are the 2 files: test.aspx: * ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** * <%@ Page Language = "VB" trace = "false" ContentType = "text / html" ResponseEncoding = "iso-8859-1" %> <!DOCTYPE HTML PUBLIC "- / / W3C TR / html4 / loose.dtd "> <%@ Register TagPrefix = "fts" TagName = "Logon" src = "test.ascx" %> <html> <head> <title> Login< / title> < / head> <body id = "myBody" runat = "server" > <form id = "addForm" runat = "server"> <fts:Logon ID form> < / body> < / html> * ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** test.ascx: * ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** <script runat = "server" > Sub Page_Load(sender as Object, e as EventArgs) dim IsCheckResumes as Boolean = true if not IsPostBack Dim a as htmlControl a = CType(Page.FindControl("myBody"), htmlControl) a.Attributes.Add("onLoad", "addForm.LoginID:txtUserName.focus()") end if End Sub RegisterXXX set of methods to inject script directly (either from the control or from the Page itself. Moreover, there are several methods that are built into the ASP.NET control and page framework that will let you set default focus on controls. I did that as well