<html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head2" runat="server"> <title>Test Page</title> <script runat="server"> private string script = @" var popup = window.open('','', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'); popup.document.write(""{0}""); "; private StringBuilder body = new StringBuilder(); protected override void OnLoad(EventArgs e) { base.OnLoad(e); /// /// build your html document here /// body.Append("<html>"); body.Append("<head></head>"); body.Append("<body>"); body.Append("<h1>Hello World</h1>"); body.Append("<p>This is a popup window created on the fly"); body.Append("</body>"); } protected void OpenWindow(object sender, EventArgs e) { /// /// Check your condition /// bool myCondition = true; if (myCondition) { this.ClientScript.RegisterClientScriptBlock( this.GetType(), this.GetType().Name, string.Format(this.script, this.body.ToString()), true); } } </script> </head> <body> <form id="form2" runat="server"> <asp:LinkButton runat="server" ID="lnkButton" OnClick="OpenWindow" Text="Open a Window" /> </form> </body> </html>
Monday, September 13, 2010
How to create a popup window on the fly using java script in c# code behind
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment