FAQ'S ON ASP.NET PART TWO

What is a CompareValidatorControl?
  1. CompareValidator is used to make sure that a value matches a specified value. This control is often used when validating passwords. Important properties of this control are .ControlToValidate and .ControlToCompare.
  2. .ControlTovalidate property is used to set the control to be validated and the .ControlToCompare property is used to identify the control to be compared.
To work with this control drag a CompareValidatorControl, a Command Button and two TextBoxes from the ToolBox. The intention is to enter two values the textboxes. If the two values do not match, an error is generated denoting that the values are not alike.

Set the following control properties in CompareValidatorControl; .ControlToCompare property as TextBox1 and .ControltoValidate property as TextBox2.

Run the code and enter some text in both the textboxes and click the button. If both the TextBox values are the same then no error message will arise else an error.

What is a RangeValidator control?

A RangeValidator control is used to determine whether a control value falls within a specified range. The RangeValidator checks whether the value passed to the control is within the range specified. This type of watch dog is generally used when buying products online like tickets etc.

To work with the RangeValidator control, drag a TextBox and a RangeValidator Control from the toolbox. Open the RangeValidator control properties and enter a value of 8 in the MaximumValue field, 3 in the MinimumValue field and set TextBox1 as the control to be validated.

Run the code and try entering some values in the TextBox. If the value entered is within the specified range ( 8 High, 3 Low ) then nothing happens else an error message is displayed.

What is a RegularExpressionValidator?

RegularExpressionValidator control is used to check a value against a regular expression. It checks whether the value of the associated input control matches the pattern of the regular expression. This Control generally used to check whether the entered phone number or email address matches a set format. A notable property of this control is the ValidationExpression property, which is used to set the validation criteria and which comes with some predefined formats.

To work with a RegularExpressionValidator control; Drag a TextBox and a Command Button from the ToolBox. Our intention is to check for the format of an email address and display an error message if the input format is not correct. An example of a correctly formated inpput would be "xyz@programmersheaven.com". To implement format definition. In the properties window of the Regularexpression click on the ellipse button for ValidationExpression and select Internet E-mail Address from the pop-up window. When you run the program and enter a value not in the format of abc@xyz.com the error message is displayed.

What is the difference between a Web User Control and a Web Custom Control?

Web custom controls are compiled components that run on the server and encapsulate the user-interface and other related functionality into reusable packages. They can include all the design-time features of standard ASP.NET server controls, including full support for Visual Studio design features such as the Properties window, the visual designer, and the Toolbox. There are several ways to create Web custom controls:

You can compile a control that combines the functionality of two or more existing controls. For example, if you need a control that encapsulates a button and a text box. You can create it by compiling the existing controls together.

If an existing server control almost meets your requirements but lacks some required features, you can customize the control by deriving from it and overriding its properties, methods, and events.

If none of the existing Web server controls (or their combinations) meet your requirements, you can create a custom control by deriving from one of the base control classes. These classes provide all the functionality like other Web server controls. You only need to write the logic for the programming features you require.

If none of the existing ASP.NET server controls meet the specific requirements of your applications, you can create either a Web user control or a Web custom control that encapsulates the functionality you need.

The main difference between the two controls lies in ease of creation vs. ease of use at design time. Web user controls are easy to make, but they can be less convenient to use in advanced scenarios. Web user controls can be developed almost exactly the same way that you develop Web Form pages.

Like Web Forms, user controls can be created in the visual designer or they can be written with code separate from the HTML. They can also support execution events. However, since Web user controls are compiled dynamically at run time they cannot be added to the Toolbox and they are represented by a simple placeholder when added to a page.

This makes Web user controls harder to use if you are accustomed to full Visual Studio .NET design-time support, including the Properties window and Design view previews. Also the only way to share the user control between applications is to put a separate copy in each application, which takes more maintenance if you make changes to the control.

Web custom controls are compiled code, which makes them easier to use but more difficult to create. Web custom controls must be authored in code. Once you have created the control you can add it to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP.NET server controls. In addition you can install a single copy of the Web custom control in the global assembly cache and share it between applications, which make maintenance easier.

Windows Forms

What are windows form applications?

Windows form applications are standard applications for Windows operating system having a user interface. A windows form application usually has one or more forms containing menus and other user interface controls like buttons, text boxes, tree view, etc. Windows form applications are like any other application on Windows except that it has its own Graphical User Interface (GUI). Common examples of windows form applications include Microsoft Word, Adobe Photoshop and Winamp.

Windows form applications are event based, i.e., they perform certain operations on user action. For example, Microsoft Word saves the document into disk file only when you ask the application to do so (selecting File > Save).


How are the Windows form applications different from the Console Applications?

Windows applications are facilitated with the Windows standard user interface controls (like button, text box, list box, picture box and etc) and the standard events of Windows operating system. On the other hand, the Console Application can only take user input and output from/to the Console, command or a shell window.

Windows form applications are more responsive and may use a lot of features like shortcut and icons. On the other hand, console applications are light weight and are used for testing and background service type applications. Several Java based web servers are implemented on Windows using Console application.

How are the Windows form applications different from the Console Applications?

Windows applications are facilitated with the Windows standard user interface controls (like button, text box, list box, picture box and etc) and the standard events of Windows operating system. On the other hand, the Console Application can only take user input and output from/to the Console, command or a shell window.

Windows form applications are more responsive and may use a lot of features like shortcut and icons. On the other hand, console applications are light weight and are used for testing and background service type applications. Several Java based web servers are implemented on Windows using Console application.

What support does the Visual Studio.NET provide for the development of .NET win form applications?

Visual Studio.NET provides an enormous support for the development of Win Form applications. The key features of Visual Studio.NET IDE include:
  1. • The form designer allows you to design the User Interface (UI) of the applications by simple drag and drop of the controls.
  2. • The Properties window allows you to set different properties for form and a number of windows controls
  3. • The Intellisense (help completing the syntax as you place dot (.) with objects, enumeration and namespace and when you create new objects)
  4. • Project and solution management with solution explorer that helps manage applications consisting of multiple files, which is what usually happens
  5. • Standard debugger that allows you to debug your program by putting break points for observing run-time behavior of the variables and objects in the program
  6. • Hot compiler that checks the syntax of your code as you type it and report any errors present
  7. • Dynamic Help on number of topics using Microsoft Development Network (MSDN) Library
  8. • Compilation and building applications
  9. • Execution of your application with/without debugger
  10. • Deploying your .NET application over the Internet or on CDs

RELATED POST

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART ONE

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART TWO

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART THREE

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART FOUR

ASP.NET INTERVIEW QUESTIONS AND ANSWERS PART FIVE

ADO.NET INTERVIEW QUESTIONS AND ANSWERS PART ONE

ADO.NET INTERVIEW QUESTIONS AND ANSWERS PART TWO

You can also learn the concept of frame work concept in detail with questions and answers in the following place.

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART ONE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART TWO

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART THREE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART FOUR

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART FIVE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART SIX

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART SEVEN

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART EIGHT

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART NINE

MICROSOFT DOT NET FRAME WORK QUESTIONS AND ANSWERS PART TEN

No comments:

Post a Comment