User Control

Validation Controls

Before saving the data entered by the user into a webform, we will have to validate the data. A web form is form which is used to accept data from the user in a web application. We will how to use the validation in a webform to perform the validations against the data entered by the user. Validation controls are controls which help us to perform different validations on the data entered in controls like Textbox, Listbox and radiobutton.

Strings

Strings are supported by the .NET String class. The String data type can represent a series of characters and can contain approximately up to 2 billion Unicode characters. There are many built-in functions in the String class. Some .NET Framework function are also built into the String class. Some common String functions are discussed below:

  • LCase: Converts a string to lower case
  • UCase:Converts a string to uppercase
  • Len: Calculates the number of characters in the string
  • LTrim:Omits spaces that appear on the left-side of the string
  • RTrim:Omits spaces that appear on the Right-side of the string
  • Trim: Omits both leading and trailing spaces
  • Clone: Clones a string
  • Concat:Joins two strings
  • Space: Used to create a string with spaces
  • Left: Takes two arguments and return a string that consists of the left most characters of the string sent
  • Right: Takes two arguments and return a string that consists of the Right most characters of the string sent
  • Instr: Searches and return a shorter string within a long string
  • Replace:Searches for a small string in a long string and replace it with the specified string.

Arrays in ASP.NET

Arrays allows you to store a series of value that have the same data type. Each individual value in the array is accessed using one or more index number. It's often convenient to picture arrays as list of data (if the array has more then one dimension) or grids of data (if the array has two dimension). Typically, arrays are laid out contiguously in memory.
All arrays start start at a fixed lower bound. This rule has no exception. When you create an array in C#, you specify the numbers of elements.Because counting start at 0, the highest index is actually one fewer than the number of elements.

//Create an array with four string (from index 0 to index 3).

//You need to initialize the array with the new keyword in order to use it:
string[] vStringArray1=new string[4];

//Create a 2*4 grid array (with a total of 8 integers).
int[,] vIntArray1=new int[2,4];

Single-Value, or "Simple," Data Binding

You can use single-value data binding to add information anywhere on an ASP.NET page. You can even place information into a control property or as plain text inside as HTML tag. Single-value data binding allows you to take a variable, a property, or an expression and insert it dynamically into a page.

Types of ASP.NET Data Binding

Two types of ASP.NET data binding exist: single-value binding and repeated-value binding.
Single-value data binding is by far the simpler of the two, whereas repeated-value binding provides the foundation for the most advanced ASP.NET data controls.

Data Binding

The basic principle of data binding is this: you tell a control where to find your data and how you want it display, and the control handle the rest of the details. Data binding in ASP.NET is superficially similar to data binding in the world of desktop or client/server application, but in truth, it's fundamentally different.In those environment, data binding involves creating a direct connection between a data source and a control in an application window.if a user change a value in the on-screen control, the data in the linked database is modified automatically. Similarly, if the database changes while the user is working with it (for example, another user commits a change), the display can be refreshed automatically.