| |||||
Adding Web Server Controls to a Web Forms PageASP.NET Web Forms Web Forms Server Controls Programming Web Forms Server Controls Adding Web server controls to a Web Forms page is like adding any HTML element, except that you declare them with an XML tag that references the asp namespace. You can add a Web server control by declaring it directly in the .aspx file.
To add a control using ASP.NET syntaxType the element representing the control into the .aspx file. The exact syntax you use depends on the control you are adding, but in general the following applies:
The following examples show typical declarations for Web server controls: <!-- Textbox ASP.NET control -->
<asp:textbox id=TextBox1 runat="Server" Text=""></asp:textbox>
<!-- Same, but with self-closing element -->
<asp:textbox id=Textbox1 runat="Server" >
<!-- Web DropDownList control, which contains subelements -->
<asp:DropDownList id=DropDown1 runat="server">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:DropDownList>
<asp:Repeater id=Repeater2 runat="server">
<headertemplate">
Company data:
</headertemplate>
<itemtemplate>
<asp:Label runat="server"
Font-Name="verdana" Font-Size="10pt"
Text='<%# ( ( PositionData ) Container.DataItem ) .Name %>' />
( <asp:Label runat=server
Font-Name="verdana" Font-Size="10pt"
Text='<%# ( ( PositionData ) Container.DataItem ) .Ticker %>'/>
)
</itemtemplate>
<separatortemplate">
,
</separatortemplate>
</asp:Repeater>
For information about the declarative syntax for a specific control, see ASP.NET Syntax for Web Controls. See AlsoAdding Controls to a Web Forms Page Programmatically Adding HTML Server Controls to a Web Forms Page Setting HTML Server Control Properties Programmatically Setting Web Forms Server Control Properties Web Forms Validation |
| ||||
Check out related books at Amazon
© 2000-2008 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 aspxtreme