日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > asp.net >内容正文

asp.net

Asp.Net第二章服务器端控件

發布時間:2024/1/23 asp.net 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Asp.Net第二章服务器端控件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

服務器端控件

主要有:Label、TextBox、Button、RadioButton、CheckBox、RadioButtonList、CheckBoxList、HyperLink控件。

控件

Label、TextBox

?<form id="form1" runat="server"><div><!--html控件,html服務器端控件,asp.net服務端控件--><input type="text" name="uname1" /><br /><input type="text" name="uname1" runat="server"/><br /><asp:Label ID="lbl" Text="我是服務器端控件" runat="server" /></div></form>

TextBox:設置密碼或多行

使用TextMode屬性; SingleLine:單行 Password:密碼;Multiline:多行;

AutoPostBack:自動提交;

?

RadioButton RadioButtonList

GroupName:設置這個

Text Value

? String msg = "";?if (RadioButton1.Checked)msg += RadioButton1.Text;if (RadioButton2.Checked)msg += RadioButton2.Text;//asxh:request response?msg+=",直轄市:"+RadioButtonList1.SelectedItem.Text+",競爭力值:"+RadioButtonList1.SelectedValue;Response.Write("性別:"+msg);

?

DropDowList

? if (DropDownList1.SelectedItem.Text != "請選擇所在城市")Response.Write("您所在的城市為:"+DropDownList1.SelectedItem.Text);elseResponse.Write("請選擇所在城市");

LIstBox控件,是將DropDowList的內容,可以一次性顯示出來。DropDownList下拉效果。

?for (int i = srcList.Items.Count - 1; i >= 0; i--) {//先獲取源頭List的Items[i]項//ListItem item = srcList.Items[i];//if (item.Selected) {// ? destList.Items.Add(item);// ? srcList.Items.Remove(item);//}//多種方式的實現ListItem item=srcList.SelectedItem;if (item!=null){destList.Items.Add(srcList.SelectedItem);srcList.Items.Remove(srcList.SelectedItem);}}

?

CheckBox、CheckBoxList

? string msg = " ",hobby="";?if (CheckBox1.Checked)msg += CheckBox1.Text;if (CheckBox2.Checked)msg += CheckBox2.Text;if (CheckBox3.Checked)msg += CheckBox3.Text;if (CheckBox4.Checked)msg += CheckBox4.Text;if (CheckBox5.Checked)msg += CheckBox5.Text;//針對CheckBoxList做一個循環for (int i = 0; i < CheckBoxList1.Items.Count; i++) { //其中每一項是一個Item,屬性是Selectedif (CheckBoxList1.Items[i].Selected) {hobby += CheckBoxList1.Items[i].Text;}}??String str = String.Format(@"您的期待崗位是'{0}',愛好是'{1}'", msg,hobby);Response.Write(str);

?

?

總結

以上是生活随笔為你收集整理的Asp.Net第二章服务器端控件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。