The Button control is used to submit the form back to the server(postback). This happens automatically in opposite to other controls where you have to enable the AutoPostBack property have the save effect. Buttons have a CauseValidation property to trigger validation of all validation controls assigned to the same group.
It is possible to use several buttons in a container control like a DataGrid or a GridView. All these buttons have the same ID and it will be impossible to bind an event handler to each button control's Onclick event(or other event) to determine the particular button that was clicked. That's why buttons have a CommandName and CommandArgument property to determine which button you clicked and deliver the correct argument to the event handler.
TextBox Server Control
The Textbox control enables the user to enter text. You have the possibility to use the textbox as a single line, multiline or password field by changing the TextMode property. The display width of textbox is determine by its columns property and the height of a textbox is determine by the Row property (only for multiline textmode). You can limit the number of signs the user can enter for a textbox with its textmode set to SingleLine or Password by entering a value for MaxLength.
A very useful event for the textbox control is OnTextChanged. When the cursor focus leaves the textbox this event is triggered. You can use this event to control the input at the very moment the user is done with editing his text.
A very useful event for the textbox control is OnTextChanged. When the cursor focus leaves the textbox this event is triggered. You can use this event to control the input at the very moment the user is done with editing his text.
Label Server Control
The label control display text in a set location on the page. Unlike static text, the Text property of a label can be change programmatically. Layout of the text can be done programmatically by changing properties or with HTML tags(Which are allowed) in the text itself.
Introduction to Server Controls
Every server control has a tag with the runat="server" attribute and is converted to a client specific XHTML.ASP.NET server controls are object and have their own properties method and event handlers. The most useful inherited properties are:
- Controls: gives a collection with all child controls for a specified server control
- EnableViewState: boolean to decide whether the controls has to track his current state or not
- ID: id of the server control,maybe the most important property
- Visible: boolean to decide if the controls will be rendered
- DataBind(): binds the controls with a certain data source (e.g resultset of an sql query)
- FindControl(): searches a child control with the given name(string)
- HasControls(): boolean that define if this server control owns child controls
Subscribe to:
Posts (Atom)