0% found this document useful (0 votes)
63 views3 pages

Definition and Usage

The RangeValidator control checks that a user-entered input value falls within a specified range of values. It can check ranges for numbers, dates, and characters. The example shows a RangeValidator that checks a date textbox to be between 2005-01-01 and 2005-12-31. ASP.NET maintains the viewstate to repopulate form fields on postback, unlike classic ASP which clears all fields.

Uploaded by

Chirag Kapadia
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views3 pages

Definition and Usage

The RangeValidator control checks that a user-entered input value falls within a specified range of values. It can check ranges for numbers, dates, and characters. The example shows a RangeValidator that checks a date textbox to be between 2005-01-01 and 2005-12-31. ASP.NET maintains the viewstate to repopulate form fields on postback, unlike classic ASP which clears all fields.

Uploaded by

Chirag Kapadia
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ASP.

NET RangeValidator Control Definition and Usage The RangeValidator control is used to check that the user enters an input value that falls between two values. It is possible to check ranges within numbers, dates, and characters. <html> <body> <form runat="server"> Enter a date between 2005-01-01 and 2005-12-31: <br /> <asp:TextBox id="tbox1" runat="server" /> <br /><br /> <asp:Button Text="Submit" runat="server" /> <br /><br /> <asp:RangeValidator ControlToValidate="tbox1" MinimumValue="2005-01-01" MaximumValue="2005-12-31" Type="Date" EnableClientScript="false" Text="The date must be between 2005-01-01 and 2005-12-31!" runat="server" /> </form> </body> </html> Maintaining the ViewState When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState. When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come? This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control.

4.Difference between trace and debug: Debug and trace enables you to monitor the application for errors and exception with out VS.NET IDE. In Debug mode compiler inserts some debugging code inside the executable. As the debugging code is the part of the executable they run on the same thread where the code runs and they do not given you the exact efficiency of the code ( as they run on the same thread). So for every full executable DLL you will see a debug file also as shown in figure Debug Mode. Trace works in both debug as well as release mode. The main advantage of using trace over debug is to do performance analysis which cannot be done by debug. Trace runs on a different thread thus it does not impact the main code thread.

5.What is custom tag in web.config ? Custom tag allows you to create your own tag and specify key value pair for it. Providing a new header information in which you can store up your customized information. So that, by parsing appropriate tags you can retrieve the values in run time. To add a custom tag to Web.config you need to first explicitly specify the new tag name in Web.config via the <configSections> tag <appSettings> <add key=Name value=Rakesh Chauhan/> <add key=Address value=Botad, Gujarat /> <add key=Contact value=chauhan.rakesh514@gmail.com /> </appSettings>

6. global.asax file The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HttpModules. The Global.asax file resides in the root directory of an ASP.NET-based application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. The Global.asax file itself is configured so that any direct URL request for it is automatically rejected; external users cannot download or view the code written within it. 7.session and application objects A session is the time for which a particular user interacts with a web application. During a session the unique identity of the user is maintained internally. A session ends if there is a session timeout or if you end the visitor session in code.

Sessions in ASP.NET are simply hash tables in the memory with a timeout specified. Consider the following examples

Session(username) = Aayush Puri

Session(color) = Blue

This assigns the values Aayush Puri and Blue to the session variables username and color, respectively. If I need to know the username or color in subsequent pages, I can use

Session(username), Session(color). Sessions in ASP.NET are identified using 32-bit long integers known as Session IDs. The ASP engine generates these session IDs so that uniqueness is guaranteed. Application Objects As we saw in the previous section, sessions help us preserve data on a per user basis. What if we want to initialize variables that are available in a session and that are the same for all users? This means that a change in the value of an application variable is reflected in the current sessions of all users. For example, we may like to fix variables like tax rate, discount rate, company name, etc., that will be specified once for all variables we can access in a session. This is where application variables come in. Heck, they can even be used to show legal notices at the bottom of every page! Creating an application variable is similar to session variables.

Application(legal_notice) = No part of this article may be reproduced without prior permissio

There is a concern when changing the value of an application variable: at any particular instant, multiple sessions might be trying to change the value, although only one session can be allowed to change it. ASP.NET has an in built mutual exclusion for dealing with these types of problems.

Application.Lock Locks the application variables Application.Unlock Unlocks the application variables

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy