Category: asp.net 1.1
How to get month date view between two dates in c#
Scenario I got while developing some application. I required month and year view in drop down list between contract starting and ending date. Like “March 2009” “April 2009” until march 2011 so on. I...
Export GridView from aspx page to Pdf using iTextSharp in asp.net
very helpful link i found on internet http://csharpdotnetfreak.blogspot.com/2008/12/export-gridview-to-pdf-using-itextsharp.html
regular expression for email address validation
hi use this regular expression for email address validation ^[A-Za-z0-9](([_.-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([.-]?[a-zA-Z0-9]+)*).([A-Za-z]{2,})$ Regular expression validator in asp.net would be like Chears…
how to get server.mappath in c# class
i face a problem that server.mappath did not available in c# class at my utillity framework at app code folder of one of my asp.net application. While it is available at asp.net page code...
how to clear controls in asp.net c#
Use following code in you page. At Calling Statement send reference of page “this”. It Clears all text boxes and set all checkboxes on page to false private void ClearControls(Control parent) { foreach (Control...
Registering ASP.NET on IIS after installing the .NET Framework
Usually this problem occur when we install iIs after installation of Visual studio or .net framework. For this purpose use aspnet_regiis.exe, it is located under %WindowsDir%Microsoft.NETFrameworkvx.y.zzzz and you should call it with the -i...
How to remove duplicate from string array in .net
In one case i have to right a method to remove duplication from array of strings. i write this code Public Function RemoveDuplicates(ByVal items As String()) As String() Dim noDupsArrList As New ArrayList() For...
How to filter uploader control using client side script in asp.net
For any client side action we have to choose a scripting language to build our logic. Let us go for JavaScript. When use a file control we have to use a button control for...
How to add dynamic meta tags in asp.net
Hi all you can add meta tags like that in page HtmlMeta _MyName = new HtmlMeta(); _MyName.Name =” Ali Raza”; _MyName.Content =” just in and test “; Page.Header.Controls.Add(_MyName);
How to get uploaded image dimensions in asp.net
I used following code to get uploaded image dimensions . Where flLogoUplaoded is name of asp .net file uploaded control at my application string UploadedImageType = flLogoUpload.PostedFile.ContentType.ToString().ToLower(); string UploadedImageFileName = flLogoUpload.PostedFile.FileName; //Create an image...
Session vs ViewState
Session State is useful for storing values that must be persisted across multiple pages by the same user. ViewState is useful for storing serializable data that must be persisisted across PostBacks by a single...
URL Encoding in asp.net
One of way while transferring data from one page to other page is Querystring. But one problem is with Querystring is that many characters are not allowed in url. So we must have to...
How to make better URI
It should be as short as possible. Don’t sacrifice consistency or obviousness, but be brief. Organize and name things logically. ASP.NET isn’t always helpful in keeping a clean structure, so I highly recommend that...
How to write word document in asp.net
You can add follwing code at page level function and called in button or page load function Void GenerateWordDoc() { string strDocBody; try { strDocBody = “<html “ + “xmlns:o=’urn:schemas-microsoft-com:office:office’ “ + “xmlns:w=’urn:schemas-microsoft-com:office:word’” +...
How to access detailed information of a visitor in asp.net
In ASP.NET, the Request.ServerVariables collection holds a lot of useful information about the visitor. For example: // Getting ip of visitor string ip = Request.ServerVariables[“REMOTE_ADDR”]; // Getting the page which called the script string...
How do I find difference between two dates? In C#
DateTime startDate = new DateTime(2005, 2, 1, 3, 4, 12, 56); // End date DateTime endDate = new DateTime(2005, 12, 12, 4, 30, 45, 12); // Time span TimeSpan diffDate = endDate.Subtract ( startDate...