asp.net.ph

HtmlInputControl.Value Property

System.Web.UI.HtmlControls Namespace   HtmlInputControl Class


Sets or retrieves the value associated with the HtmlInputControl.

Syntax


Inline <input value = strValue ... >
Script HtmlInputControl.Value [ = strValue ]

Property Value


strValue String specifying the value associated with the HtmlInputControl.

The property is read/write with a default value that depends on the type of control.

Remarks

Use this property to specify or determine the value associated with the HtmlInputControl.

Value depends on the type of control.

  • for control types that accept user input — such as text, file, textarea, and select — value represents the user input.
  • for checkboxes and radio buttons, value represents the internally defined value.
  • for buttons, value assigns the button caption. If not specified, value defaults to:
    • Submit Query for the submit button control.
    • Reset for the reset button control.

All other input controls have no default value.

To be submitted with the data associated with a <form>, each of the form input controls must be assigned a Name and have a valid Value. Only controls with a valid name/value pair are sent with the HTTP Request message to the receiving program for processing.

These name/value pairs are then accessible on the server via the Request.Params, Request.Form, or Request.QueryString collections.

Example

The below code shows how to declaratively set the values associated with HtmlInputRadioButton controls at design time, and how these values are used by a submit handler at run time.

<p>Choose what suits you: <br>
   <input type=radio id="cool" runat=server
      value="background:navy; color:lime">Cool
   <input type=radio id="soso" runat=server
      value="background:gainsboro; color:dimgray">So-So
   <input type=radio id="warm" runat=server
      value="background:maroon; color:gold">Warm

 Show me 

This example retrieves the values of input controls submitted with a form using POST, by looping thru the Request.Form collection.

 Show me 

This example retrieves the values of input controls submitted with a form using GET, by looping thru the Request.QueryString collection.

 Show me 

See Also

HtmlInputControl Members   Name Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph