Hello All, We are going to start new batch from next week. message/call or mail us for more details.

17 September 2012

Stop auto-fill in browsers for textbox


Today’s browsers like Chrome, Firefox, Internet Explorer and Safari has functionality of auto complete values in TextBoxes. If you have enabled this features in your browser, then each and every time when you start to enter value in TextBox you get a drop down of prefilled values in that TextBox. This feature of browser can be disabled by the programming for a specific web form like payment form and other confidential information form of a web application.
In chrome browser, we can enable auto-fill as shown below:
Suppose we have a below form for online payment of product by credit card or debit card then it is mandatory to stop auto complete functionality of browser so that browser doesn’t save the confidential information of a customer’s credit card or debit card.
We can turn off auto-fill for our complete form by setting autocomplete attribute value to off as shown below:
<form id="Form1" method="post" runat="server" autocomplete="off">
</form>
We can also turn off auto-fill for a particular TextBox by setting autocomplete attribute value to off as shown below:
<asp:TextBox Runat="server" ID="txtConfidential" autocomplete="off">
</form>
We can also do this from code behind also like as:
txtConfidential.Attributes.Add("autocomplete", "off");










Maintain Scroll Position on Postback in ASP.NET 2.0


This article shows how to allows pages to automatically maintain the current scroll position across postbacks.
The MaintainScrollPositionOnPostback page directive attribute allows to do that.
This feature is useful for large pages where scrolling is necessary to view input controls down further on the page.
There are three ways of applying the property to a web page.
  1. You can set it programmatically 
    Page.MaintainScrollPositionOnPostBack = true;
  2. In the page declaration 
    <%@ Page MaintainScrollPositionOnPostback="true" %>
  3. Or in the web.configs <system.web> section. 
    <pages maintainScrollPositionOnPostBack="true" />
This feature is an absolute must-have on large web pages built for postback scenarios.
A simple but very useful feature.
Smartnavigation = true  implemented the same feature in 1.1 framework 
SmartNavigation only had "issues" and it only worked in IE but the new MaintainScrollPositionOnPostback apparently works in most common browsers.