zoukankan
html css js c++ java
控件数据绑定Xml做数据源
XmlDataSource Bind ServceControl
TextBox
RadioButtonList
Original Crust
Hand-Stretched Crust
Pan Crust
Oval Edge Crust
Square Crust
ListBox
Supreme
Capricciosa
Hawaiian
Mexican Fiesta
Italian Classic
Margherita
Meat Lover
Pepperoni
Vegetarian
CheckBoxList
Beef Bacon
Capsicum
Chicken
Fresh Tomato
Ham
Jalapno
Mushrooms
Olives
Onion
Pepperoni
Pineapple
RadioButtonList
No
Yes
<
form
id
="form1"
runat
="server"
>
<
h1
>
XmlDataSource Bind ServceControl
</
h1
>
<
table
width
="100%"
>
<
tr
>
<
td
>
TextBox
</
td
>
<
td
>
<
asp:TextBox
ID
="txtName"
Columns
="25"
runat
="server"
/>
</
td
>
</
tr
>
<
tr
>
<
td
valign
="top"
>
RadioButtonList
</
td
>
<
td
>
<
asp:RadioButtonList
ID
="rblCrust"
TextAlign
="right"
RepeatDirection
="horizontal"
RepeatColumns
="3"
RepeatLayout
="table"
DataTextField
="desc"
DataValueField
="value"
runat
="server"
/>
</
td
>
</
tr
>
<
tr
>
<
td
valign
="top"
>
ListBox
</
td
>
<
td
>
<
asp:ListBox
ID
="lstTopping"
Rows
="1"
DataTextField
="desc"
DataValueField
="value"
runat
="server"
/>
</
td
>
</
tr
>
<
tr
>
<
td
valign
="top"
>
CheckBoxList
</
td
>
<
td
>
<
asp:CheckBoxList
ID
="cblAdditionalTopping"
RepeatDirection
="horizontal"
TextAlign
="right"
RepeatColumns
="3"
RepeatLayout
="table"
DataTextField
="desc"
DataValueField
="value"
runat
="server"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>
RadioButtonList
</
td
>
<
td
>
<
asp:RadioButtonList
ID
="rblDoubleCheese"
RepeatDirection
="horizontal"
TextAlign
="right"
RepeatLayout
="flow"
DataTextField
="desc"
DataValueField
="value"
runat
="server"
/>
</
td
>
</
tr
>
</
table
>
</
form
>
protected
void
Page_Load(
object
sender, EventArgs e)
{
String xmlFilePath
=
Server.MapPath(
"
XmlDataSource.xml
"
);
if
(
!
IsPostBack)
{
//
Create a new DataSet
DataSet dataSet
=
new
DataSet();
//
Read XML file and populate tables
dataSet.ReadXml(xmlFilePath);
//
Data bind RadioButtonList the verbose way
rblCrust.DataSource
=
dataSet;
rblCrust.DataMember
=
"
crust
"
;
rblCrust.DataBind();
//
Data bind ListBox the shortcut way
lstTopping.DataSource
=
dataSet.Tables[
"
topping
"
].DefaultView;
lstTopping.DataBind();
//
Data bind CheckBoxList in sorted order
DataView dataView
=
dataSet.Tables[
"
addtopping
"
].DefaultView;
dataView.Sort
=
"
desc Asc
"
;
cblAdditionalTopping.DataSource
=
dataView;
cblAdditionalTopping.DataBind();
//
Data bind RadioButtonList
rblDoubleCheese.DataSource
=
dataSet.Tables[
"
yesno
"
].DefaultView;
rblDoubleCheese.DataBind();
}
}
<?
xml version="1.0" encoding="utf-8"
?>
<
lookup
>
<!--
START OF: Topping
-->
<
topping
>
<
value
>
supreme
</
value
>
<
desc
>
Supreme
</
desc
>
</
topping
>
<
topping
>
<
value
>
capricciosa
</
value
>
<
desc
>
Capricciosa
</
desc
>
</
topping
>
<!--
END OF: Topping
-->
<!--
START OF: Additional Topping
-->
<
addtopping
>
<
value
>
onion
</
value
>
<
desc
>
Onion
</
desc
>
</
addtopping
>
<
addtopping
>
<
value
>
capsicum
</
value
>
<
desc
>
Capsicum
</
desc
>
</
addtopping
>
<!--
END OF: Additional Topping
-->
<!--
START OF: Crust
-->
<
crust
>
<
value
>
original
</
value
>
<
desc
>
Original Crust
</
desc
>
</
crust
>
<
crust
>
<
value
>
handstretched
</
value
>
<
desc
>
Hand-Stretched Crust
</
desc
>
</
crust
>
<!--
END OF: Crust
-->
<!--
START OF: Misc
-->
<
yesno
>
<
value
>
0
</
value
>
<
desc
>
No
</
desc
>
</
yesno
>
<
yesno
>
<
value
>
1
</
value
>
<
desc
>
Yes
</
desc
>
</
yesno
>
<!--
END OF: Misc
-->
</
lookup
>
查看全文
相关阅读:
1040 最大公约数之和
51nod 1215 数组的宽度
51nod 1423 最大二“货” 单调栈
51nod 1437 迈克步 单调栈
1564 区间的价值
51nod 1294 修改数组
51nod1693 水群 最短路
51nod1052 最大M子段和
我不管,这就是水题《1》
河工大校赛 Hmz 的女装 http://218.28.220.249:50015/JudgeOnline/problem.php?id=1265
原文地址:https://www.cnblogs.com/RuiLei/p/897051.html
最新文章
hihoCoder 1426 : What a Ridiculous Election(总统夶选)
hihoCoder 1425 : What a Beautiful Lake(美丽滴湖)
hihoCoder 1432 : JiLi Number(吉利数)
HDU 5968 异或密码
HDU 5980 Find Small A(寻找小A)
HDU 5938 Four Operations(四则运算)
HDU 5934 Bomb(炸弹)
HDU 5860 Death Sequence(死亡序列)
HDU 5842 Lweb and String(Lweb与字符串)
Chip Factory ---- UVALive
热门文章
Almost Sorted Array ---- UVALive
Daydreaming Stockbroker----Gym
可以关闭博客园广告的代码
清除浏览器某些默认样式
滚动到界面,元素缓慢滑出(jquery / css)
Interesting Integers Gym
Gym 101190A------- Abbreviation(字符串 模拟)
Gym
Abbreviation-----ACM ICPC 2016–2017, Northeastern European Regional Contest(字符串 模拟)
七大内排序
Copyright © 2011-2022 走看看