Thursday, September 30, 2010
How to upload a file?
- How to upload a file?
- How to validate file type in client side?
- How to find file size in client side?
- How to find file last modified date in client side?
- How to find file created date in client side?
- How to validate file type in server side?
- How to handle files which exceeds the limits?
- How to show the selected image without saving the image on the disk?
- How to rename the file if the filename exists in the folder while uploading?
Wednesday, September 29, 2010
How to save details and print a page
Demo:
Useful links:
Useful links:
- Opening a window after postback
- Java script print function
- Apply diffrnet styles whlie printing
- Print fit to page and backgrounds
<%@ Page Language="C#" %> <html> <head runat="server"> <script runat="server"> private string script = @" window.open('{0}','', 'scrollbars=no,menubar=no, height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'); "; protected override void OnLoad(EventArgs e) { base.OnLoad(e); string m = this.Request.QueryString.Get("mode"); if (!string.IsNullOrEmpty(m)) { this.ClientScript.RegisterStartupScript(this.GetType(), this.GetType().Name, "window.print();", true); this.btnSaveAndPrint.Visible = false; } else this.btnSaveAndPrint.Visible = true; } protected void SaveAndPrint(object sender, EventArgs e) { string page = this.Request.Url.ToString(); if (page.Contains("?")) page = page + "&mode=print"; else page = page + "?mode=Print"; /// /// Save your data... /// Page.ClientScript.RegisterClientScriptBlock( this.GetType(), this.GetType().Name, string.Format(this.script, page), true); } </script> </head> <body> <form id="form1" runat="server"> <h1> Thank you for purchaing our products</h1> <hr /> <asp:TextBox runat="server" ID="txtName" Text="Name" /><br /> <asp:TextBox runat="server" ID="txtAddress" Text="Address" /><br /> <asp:TextBox runat="server" ID="txtEmail" Text="mail@email.com" /><br /> <asp:TextBox runat="server" ID="txtPhone" Text="0123456789" /><br /> <hr /> <p> I started this site in 2005 to write down simple but important code snippets which I may forget easily. Most of the posts/articles published in this site are not rock complicated but they are simple answers to questions, which people may find hard to remember How To Do them. Today in 2010, almost all posts/articles are common answers to the questions raised in Asp.net Forms. All of these posts/articles been tested against certain criteria which suits to subject of the post. But it is essential you to understand the domain of the post and apply them in appropriate context. Most of the posts have being through couple of reviews after feedback from asp.net community users. However I DO NOT provide any warranty for these code snippets, which may work in your application context. Use these examples at your own risk. However if you find obvious syntax error or typo, please feel free to let me know by commenting them, so that I can improve the post for other asp.net community users of this site. Please remember you are NOT ALLOWED to COPY entire articles/posts and publish them your context without my knowledge and permission. </p> <asp:Button runat="server" ID="btnSaveAndPrint" Text="Save and Print" OnClick="SaveAndPrint" /> </form> </body> </html>
How to show the progress of long running operation
- Simple example - only strat message and end message
- Detailed example - including progress bar and step processing results
- How to show the progress of a request - using JavaScripts and CSS
Subscribe to:
Posts (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...