ASP.NET Tutorial/HTML Controls/Introduction

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Important HTML Control Properties

   <source lang="csharp">

Control Most Important Properties HtmlAnchor HRef, Name, Target, Title HtmlImage Src, Alt, Align, Border, Width, Height HtmlInputCheckBox Checked HtmlInputRadioButton Checked HtmlInputText Value HtmlTextArea Value HtmlInputImage Src, Alt, Align, Border HtmlSelect Items (collection) HtmlGenericControl InnerText and InnerHtml</source>


Use the ServerChange event for HTML controls

   <source lang="csharp">

<%@ Page Language="C#" %> <script runat="server"> public void DetectChange(object sender, EventArgs e) {

   HtmlInputCheckBox cb = (HtmlInputCheckBox) sender;
   Response.Write("Control " + cb.UniqueID + " changed
");

} </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">

   <title>Server changes</title>

</head> <body>

       <form id="Form1" runat="server">
           <input runat="server" type="checkbox" id="one" 
               onserverchange="DetectChange" />One
<input runat="server" type="checkbox" id="two" onserverchange="DetectChange" />Two
<input runat="server" type="checkbox" id="three" onserverchange="DetectChange" />Three
<input runat="server" type="submit" value="Submit" /> </form>

</body> </html></source>


Which controls provide a ServerClick event and which ones provide a ServerChange event.

   <source lang="csharp">

Event Controls That Provide It ServerClick HtmlAnchor, HtmlButton, HtmlInputButton, HtmlInputImage, HtmlInputReset ServerChange HtmlInputText, HtmlInputCheckBox, HtmlInputRadioButton, HtmlInputHidden, HtmlSelect, HtmlTextArea</source>