| 1 |
lars |
1 |
<com:TContent ID="body">
|
|
|
2 |
|
|
|
3 |
<h1>TCheckBoxList Samples</h1>
|
|
|
4 |
|
|
|
5 |
<table class="sampletable">
|
|
|
6 |
|
|
|
7 |
<tr>
|
|
|
8 |
<td class="samplenote">
|
|
|
9 |
Check box list with default settings:
|
|
|
10 |
</td>
|
|
|
11 |
<td class="sampleaction">
|
|
|
12 |
<com:TCheckBoxList>
|
|
|
13 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
14 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
15 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
16 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
17 |
</com:TCheckBoxList>
|
|
|
18 |
</td>
|
|
|
19 |
</tr>
|
|
|
20 |
|
|
|
21 |
<tr>
|
|
|
22 |
<td class="samplenote">
|
|
|
23 |
Check box list with customized cellpadding, cellspacing, color and text alignment:
|
|
|
24 |
</td>
|
|
|
25 |
<td class="sampleaction">
|
|
|
26 |
<com:TCheckBoxList
|
|
|
27 |
CellPadding="5"
|
|
|
28 |
CellSpacing="1"
|
|
|
29 |
BackColor="silver"
|
|
|
30 |
TextAlign="Left">
|
|
|
31 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
32 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
33 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
34 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
35 |
</com:TCheckBoxList>
|
|
|
36 |
</td>
|
|
|
37 |
</tr>
|
|
|
38 |
|
|
|
39 |
<tr>
|
|
|
40 |
<td class="samplenote">
|
|
|
41 |
Check box list with vertical (default) repeat direction:
|
|
|
42 |
</td>
|
|
|
43 |
<td class="sampleaction">
|
|
|
44 |
<com:TCheckBoxList RepeatColumns="3">
|
|
|
45 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
46 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
47 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
48 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
49 |
</com:TCheckBoxList>
|
|
|
50 |
</td>
|
|
|
51 |
</tr>
|
|
|
52 |
|
|
|
53 |
<tr>
|
|
|
54 |
<td class="samplenote">
|
|
|
55 |
Check box list with horizontal repeat direction:
|
|
|
56 |
</td>
|
|
|
57 |
<td class="sampleaction">
|
|
|
58 |
<com:TCheckBoxList RepeatDirection="Horizontal" RepeatColumns="3">
|
|
|
59 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
60 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
61 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
62 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
63 |
</com:TCheckBoxList>
|
|
|
64 |
</td>
|
|
|
65 |
</tr>
|
|
|
66 |
|
|
|
67 |
<tr>
|
|
|
68 |
<td class="samplenote">
|
|
|
69 |
Check box list with flow layout and vertical (default) repeat direction:
|
|
|
70 |
</td>
|
|
|
71 |
<td class="sampleaction">
|
|
|
72 |
<com:TCheckBoxList RepeatLayout="Flow" RepeatColumns="3">
|
|
|
73 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
74 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
75 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
76 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
77 |
</com:TCheckBoxList>
|
|
|
78 |
</td>
|
|
|
79 |
</tr>
|
|
|
80 |
|
|
|
81 |
<tr>
|
|
|
82 |
<td class="samplenote">
|
|
|
83 |
Check box list with flow layout and horizontal repeat direction:
|
|
|
84 |
</td>
|
|
|
85 |
<td class="sampleaction">
|
|
|
86 |
<com:TCheckBoxList
|
|
|
87 |
RepeatLayout="Flow"
|
|
|
88 |
RepeatDirection="Horizontal"
|
|
|
89 |
RepeatColumns="3">
|
|
|
90 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
91 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
92 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
93 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
94 |
</com:TCheckBoxList>
|
|
|
95 |
</td>
|
|
|
96 |
</tr>
|
|
|
97 |
|
|
|
98 |
<tr>
|
|
|
99 |
<td class="samplenote">
|
|
|
100 |
Check box list's behavior upon postback:
|
|
|
101 |
</td>
|
|
|
102 |
<td class="sampleaction">
|
|
|
103 |
<com:TCheckBoxList ID="CheckBoxList">
|
|
|
104 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
105 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
106 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
107 |
<com:TListItem Value="value 4" Text="item 4" Enabled="false" />
|
|
|
108 |
<com:TListItem Value="value 5" Text="item 5" Selected="true" />
|
|
|
109 |
</com:TCheckBoxList>
|
|
|
110 |
<com:TButton Text="Submit" OnClick="buttonClicked" />
|
|
|
111 |
<br/>
|
|
|
112 |
<com:TLabel ID="SelectionResult" ForeColor="red" />
|
|
|
113 |
</td>
|
|
|
114 |
</tr>
|
|
|
115 |
|
|
|
116 |
<tr>
|
|
|
117 |
<td class="samplenote">
|
|
|
118 |
Auto postback check box list:
|
|
|
119 |
</td>
|
|
|
120 |
<td class="sampleaction">
|
|
|
121 |
<com:TCheckBoxList
|
|
|
122 |
AutoPostBack="true"
|
|
|
123 |
OnSelectedIndexChanged="selectionChanged">
|
|
|
124 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
125 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
126 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
127 |
<com:TListItem Value="value 4" Text="item 4" Enabled="false" />
|
|
|
128 |
<com:TListItem Value="value 5" Text="item 5" Selected="true" />
|
|
|
129 |
</com:TCheckBoxList>
|
|
|
130 |
<com:TLabel ID="SelectionResult2" ForeColor="red" />
|
|
|
131 |
</td>
|
|
|
132 |
</tr>
|
|
|
133 |
|
|
|
134 |
</table>
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
<h2>Checkbox Lists with DataBinding</h2>
|
|
|
139 |
|
|
|
140 |
<table class="sampletable">
|
|
|
141 |
|
|
|
142 |
<tr>
|
|
|
143 |
<td class="samplenote">
|
|
|
144 |
Databind to an integer-indexed array:
|
|
|
145 |
</td>
|
|
|
146 |
<td class="sampleaction">
|
|
|
147 |
<com:TCheckBoxList ID="DBCheckBoxList1"
|
|
|
148 |
AutoPostBack="true"
|
|
|
149 |
OnSelectedIndexChanged="DBCheckBoxList1Changed" />
|
|
|
150 |
<com:TLabel ID="DBCheckBoxList1Result" ForeColor="red" />
|
|
|
151 |
</td>
|
|
|
152 |
</tr>
|
|
|
153 |
|
|
|
154 |
<tr>
|
|
|
155 |
<td class="samplenote">
|
|
|
156 |
Databind to an associative array:
|
|
|
157 |
</td>
|
|
|
158 |
<td class="sampleaction">
|
|
|
159 |
<com:TCheckBoxList ID="DBCheckBoxList2"
|
|
|
160 |
AutoPostBack="true"
|
|
|
161 |
OnSelectedIndexChanged="DBCheckBoxList2Changed" />
|
|
|
162 |
<com:TLabel ID="DBCheckBoxList2Result" ForeColor="red" />
|
|
|
163 |
</td>
|
|
|
164 |
</tr>
|
|
|
165 |
|
|
|
166 |
<tr>
|
|
|
167 |
<td class="samplenote">
|
|
|
168 |
Databind with DataTextField and DataValueField specified:
|
|
|
169 |
</td>
|
|
|
170 |
<td class="sampleaction">
|
|
|
171 |
<com:TCheckBoxList ID="DBCheckBoxList3"
|
|
|
172 |
AutoPostBack="true"
|
|
|
173 |
DataTextField="name"
|
|
|
174 |
DataValueField="id"
|
|
|
175 |
OnSelectedIndexChanged="DBCheckBoxList3Changed" />
|
|
|
176 |
<com:TLabel ID="DBCheckBoxList3Result" ForeColor="red" />
|
|
|
177 |
</td>
|
|
|
178 |
</tr>
|
|
|
179 |
|
|
|
180 |
</table>
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
<h2>CheckBox List with Validation</h2>
|
|
|
184 |
|
|
|
185 |
<table class="sampletable">
|
|
|
186 |
|
|
|
187 |
<tr>
|
|
|
188 |
<td class="samplenote">
|
|
|
189 |
CheckBox list causing validation:
|
|
|
190 |
</td>
|
|
|
191 |
<td class="sampleaction">
|
|
|
192 |
<com:TTextBox ID="TextBox" />
|
|
|
193 |
<com:TRequiredFieldValidator
|
|
|
194 |
ControlToValidate="TextBox"
|
|
|
195 |
ErrorMessage="You must enter a value"
|
|
|
196 |
Display="Dynamic"
|
|
|
197 |
ValidationGroup="Group2"
|
|
|
198 |
/>
|
|
|
199 |
<com:TCheckBoxList AutoPostBack="true" ValidationGroup="Group2">
|
|
|
200 |
<com:TListItem Text="Agree" />
|
|
|
201 |
<com:TListItem Text="Disagree" />
|
|
|
202 |
</com:TCheckBoxList>
|
|
|
203 |
</td>
|
|
|
204 |
</tr>
|
|
|
205 |
|
|
|
206 |
</table>
|
|
|
207 |
|
|
|
208 |
<div class="last-modified">$Id: Home.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
|