The other option will be to use Update Panel ASP.NET control as much as possible. It helps to retain the current position on the page whenever a postback happens to the page.
I do it this way:0) Create a base page class, and store the current page's url (you can do this any number of ways, so I'll leave it to your imagination):public class MyBasepage : System.Web.UI.Page{ public string CurrentUrl { get; set; } }1) Store the page's Url to a...
How about this?public static class ExtendDateTime{ public int CountWeekDays(this DateTime thisdate, DateTime thatDate) { int days = Math.Abs((thisDate - thatDate).Days) + 1; return = ((days/7) * 5) + (days % 7); }}Usage would be like this:DateTime...
I agree with Chris...string.IsNullOrEmpty: 312 msLength: 140 ms [fastest]This is not a fair comparison.Need to compare:(string != null && string.Length !=0)with: String.IsNullOrEmpty(string)Even if the first construct is faster, there is a readability...
Initializing is great... unless you have no control over the contents.Consider this:String strTmp = String.Empty;strTmp = SomeRandomMethod();//Suppose SomeRandomMethod returns null under some circumstances...Now anything you try to do with strTmp (other than compare to null) will...
Alternative For VB.NET Windows Forms Private Sub ControlEnabled(ByVal ctrl As Control, ByVal isDisable As Boolean) Me.ControlEnabled(ctrl, isDisable, True) End Sub Private Sub ControlEnabled(ByVal ctrl As Control, ByVal isDisable As Boolean, ByVal allowRecurse As...
Here is a tip for making sure that debugging your MVC website does not cause Visual Studio to crash when using IIS7 to host the site in your development environment: Don't use more than one worker. process in your Application pool.
Download access driver from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d&displaylang=en.In the connection string, replace "Microsoft.Jet.OLEDB.4.0" with "Microsoft.ACE.OLEDB.12.0".
Some times we need to detect the Browser Close to perform some operation before quiting from application. Here is a simple way.function CheckBrowser(){ // Check Browser Close [X] , Alt+F4 , File -> Close if(window.event.clientX
This is very common problem in Web development that we need tofreeze the GridView header at the time of scrolling, Here is one simpletips:Step 1 : Create a CSS class as following .HeaderFreez { position:relative ; top:expression(this.offsetParent.scrollTop); z-index: 10; } .HeaderFr
25 Feb 2010 by Abhishek Banerjee (A Web Developer)
Hello All,Today I am showing an interesting block of code which will help you in applying user search on a tree view control of asp.net applications.PrerequisitesFor this you have to create an asp.net demo project using language C#Action:Step 1: Now Create a web page with name...
It is to be noted, .NET has lately introducedResponse.RedirectParmanent() after a long await. The main motive of this is tohave permanent response redirection to the Search Engines.Response.RedirectParmanent() is an extension function introduced in .NET 4.0.Themain motive of it is to indicate
It is a very common issue to handle automatic postbacks to controls. Here I am going to explain how we can handle autopostback of a button click using Javascript Event. Suppose you have a button : Now you want to occationally c
Sometimes we have requirement to disable Right Click context menu and Text selection of a web page from the user, so that the user cannot use the right click default context menu and also to disable text selection so that sensitive data could not be copied from the website. To Disable Context Menudo
Hi Guys,It is common behavior of ASP.NET that if a control is set to Visible = "false", the response stream doesn't contain the definition of it. Therefore, if you want to make the control visible during runtime from Javascript always put display = none in styles attribute.Say you have a...
Maybe this would have saved you some efforts: http://developer.mindtouch.com/SgmlReader[^]. I have already developed a project (Delivery Predictor) with this reader: http://achristov.info/Projects.aspx[^]
A slight comparison of ASP.NET upon other (web) programming languages in the market and a discussion of me and some other (web) programming language developers.
Useful and simple tutorial to create multi-language ASP.NET website. Following these steps, you will be able to create a good user interface multi-language website with 4 main steps.
Single Sign on (SSO) Using Cookie in asp.netThere are various ways to use Single Sign on(SSO) in asp.net web application. We can use cookies, session (state server), SAML and web services etc. Now we would like to give a brief overview of how to use cookie to implement Single Sign on(SSO) in...
I will give a solution to the following problem "Response.TransmitFile(sFullHtmFilePath)" gives unformatted display of htm file on browser on client side.
Though update panel keeps the page responsive while paritially post back, it will not avoid a round trip of complete page and control events. So care needs for a better performance
Hi guys, I have a new version of this.Although it works as expected for the majority of cases, I found a problem on the previous version of this code, that is, it reuses the HttpHandler for different requests and that can be a problem on more complex implementations where inner properties are...
1) Set debug=false under compilation as follows:2) Use Server.Transfer instead of Response.Redirect.3) Always check Page.IsValid when using Validator Controls4) Use Foreach loop instead of For loop for String Iteration.5) Use Client-Side Validation. (but not all the time you have...
Here I am posting code, which will read through a Excel Document. This code will traverse through all sheets of Excel spread sheet, No matter what name they will have.This uses OLEDB connection to read through excel sheets.using System.Data.OleDb;protected void Page_Load(object...