第三篇 控件

来源:互联网 发布:java rsa 私钥加密 编辑:程序博客网 时间:2024/05/21 09:06

响应事件:                  

Protected void SubmitButton_Click(objectsender,EventArgs e)

{

Result.Text=”Your name is”+YourName.Text;

}

 

Result.Text=”Your name is”+YourName.Text

大部分服务器端控件属性都可以转换为带style特性的css内联样式。

<asp:TextBox ID=”TextBox1” runat=”server”AccessKey=”a”CssClass=”TextBox” TabIndex=”1”ToolTip=”Hover text here”Text=”Hello World”></asp:TextBox>

CSS类

.TextBox

{

Background-color:black;

Color:white;

Font-size:30px;

Border-color:yellow;

Border-width:4px;

Border-style:dashed

Height:40px;

Width:200px;

}

ListItem:列表编辑器。

添加新项<asp:ListItem>



protected void Button_Click(object sender,EventArgs e)

{

Label1.Text="In the DDL you selected"+DropDownList1.SelectedValue+"<br/>";

foreach(ListItem item in CheckBoxList1.Items)

{

if(item.Selected==true)

{

Label.Text+="In the CBL yo selected"+item.Value+"<br/>";

}

}

}


0 0