ASP.NET Web窗体服务器控件

ASP.NET Web窗体服务器控件

ASP.NET提供了用于创建HTML组件的Web表单控件。这些控件是基于服务器和客户端的类别。下表包含Web表单的服务器控件。jbB码友部落
 jbB码友部落

控制名称 适用事件 描述
标签 没有 它用于在HTML页面上显示文本。
文本框 TextChanged 它用于创建表单中的文本输入。
纽扣 单击,命令 它用于创建按钮。
链接按钮 单击,命令 它用于创建外观类似于超链接的按钮。
图像按钮 请点击 它用于创建imagesButton。在此,图像用作按钮。
超连结 没有 它用于创建响应单击事件的超链接控件。
下拉列表 SelectedIndexChanged 它用于创建下拉列表控件。
列表框 SelectedIndexCnhaged 它用于创建类似HTML控件的ListBox控件。
数据网格 CancelCommand,EditCommand,DeleteCommand,ItemCommand,SelectedIndexChanged,PageIndexChanged,SortCommand,UpdateCommand,ItemCreated,ItemDataBound 它用于创建用于显示数据的控件。我们还可以使用此控件非常容易地执行分页,排序和格式化。
数据清单 CancelCommand,EditCommand,DeleteCommand,ItemCommand,SelectedIndexChanged,UpdateCommand,ItemCreated,ItemDataBound 它用于创建非表格格式的数据列表,并用于显示数据。
复选框 CheckChanged 它用于创建复选框。
复选框列表 SelectedIndexChanged 它用于创建一组一起使用的复选框。
单选按钮 CheckChanged 它用于创建单选按钮。
单选按钮列表 SelectedIndexChanged 它用于创建一组单选按钮控件,它们一起使用。
图片 没有 它用于显示页面内的图像。
面板 没有 它用于创建用作容器的面板。
PlaceHolder 没有 用于设置控件的占位符。
日历 SelectionChanged,VisibleMonthChanged,DayRender 它用于创建日历。我们可以设置默认日期,前进和后退等。
AdRotator AdCreated 它使我们可以指定要显示的广告列表。每次用户重新显示页面时。
没有 它用于创建表。
XML格式 没有 它用于在HTML中显示XML文档。
文字 没有 就像标签一样,它显示文字,但是允许我们在运行时创建新文字并将其放入此控件中。

我们将在下一章中以示例说明每个控件。jbB码友部落

Control Name Applicable Events Description
Label None It is used to display text on the HTML page.
TextBox TextChanged It is used to create a text input in the form.
Button Click, Command It is used to create a button.
LinkButton Click, Command It is used to create a button that looks similar to the hyperlink.
ImageButton Click It is used to create an imagesButton. Here, an image works as a Button.
Hyperlink None It is used to create a hyperlink control that responds to a click event.
DropDownList SelectedIndexChanged It is used to create a dropdown list control.
ListBox SelectedIndexCnhaged It is used to create a ListBox control like the HTML control.
DataGrid CancelCommand, EditCommand, DeleteCommand, ItemCommand, SelectedIndexChanged, PageIndexChanged, SortCommand, UpdateCommand, ItemCreated, ItemDataBound It used to create a frid that is used to show data. We can also perform paging, sorting, and formatting very easily with this control.
DataList CancelCommand, EditCommand, DeleteCommand, ItemCommand, SelectedIndexChanged, UpdateCommand, ItemCreated, ItemDataBound It is used to create datalist that is non-tabular and used to show data.
CheckBox CheckChanged It is used to create checkbox.
CheckBoxList SelectedIndexChanged It is used to create a group of check boxes that all work together.
RadioButton CheckChanged It is used to create radio button.
RadioButtonList SelectedIndexChanged It is used to create a group of radio button controls that all work together.
Image None It is used to show image within the page.
Panel None It is used to create a panel that works as a container.
PlaceHolder None It is used to set placeholder for the control.
Calendar SelectionChanged, VisibleMonthChanged, DayRender It is used to create a calendar. We can set the default date, move forward and backward etc.
AdRotator AdCreated It allows us to specify a list of ads to display. Each time the user re-displays the page.
Table None It is used to create table.
XML None It is used to display XML documents within the HTML.
Literal None It is like a label in that it displays a literal, but allows us to create new literals at runtime and place them into this control.