| 1 |
lars |
1 |
<com:TContent ID="body">
|
|
|
2 |
|
|
|
3 |
<h1>TListBox Samples</h1>
|
|
|
4 |
|
|
|
5 |
<h2>List Boxes in Single Selection Mode</h2>
|
|
|
6 |
|
|
|
7 |
<table class="sampletable">
|
|
|
8 |
|
|
|
9 |
<tr>
|
|
|
10 |
<td class="samplenote">
|
|
|
11 |
List box with default settings:
|
|
|
12 |
</td>
|
|
|
13 |
<td class="sampleaction">
|
|
|
14 |
<com:TListBox />
|
|
|
15 |
</td>
|
|
|
16 |
</tr>
|
|
|
17 |
|
|
|
18 |
<tr>
|
|
|
19 |
<td class="samplenote">
|
|
|
20 |
List box with initial items:
|
|
|
21 |
</td>
|
|
|
22 |
<td class="sampleaction">
|
|
|
23 |
<com:TListBox>
|
|
|
24 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
25 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
26 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
27 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
28 |
</com:TListBox>
|
|
|
29 |
</td>
|
|
|
30 |
</tr>
|
|
|
31 |
|
|
|
32 |
<tr>
|
|
|
33 |
<td class="samplenote">
|
|
|
34 |
List box with customized row number, color and font:
|
|
|
35 |
</td>
|
|
|
36 |
<td class="sampleaction">
|
|
|
37 |
<com:TListBox Rows="3" ForeColor="blue" Font.Size="14pt">
|
|
|
38 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
39 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
40 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
41 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
42 |
</com:TListBox>
|
|
|
43 |
</td>
|
|
|
44 |
</tr>
|
|
|
45 |
|
|
|
46 |
<tr>
|
|
|
47 |
<td class="samplenote">
|
|
|
48 |
Disabled list box:
|
|
|
49 |
</td>
|
|
|
50 |
<td class="sampleaction">
|
|
|
51 |
<com:TListBox Enabled="false">
|
|
|
52 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
53 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
54 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
55 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
56 |
</com:TListBox>
|
|
|
57 |
</td>
|
|
|
58 |
</tr>
|
|
|
59 |
|
|
|
60 |
<tr>
|
|
|
61 |
<td class="samplenote">
|
|
|
62 |
Auto postback list box:
|
|
|
63 |
</td>
|
|
|
64 |
<td class="sampleaction">
|
|
|
65 |
<com:TListBox
|
|
|
66 |
AutoPostBack="true"
|
|
|
67 |
OnSelectedIndexChanged="selectionChanged">
|
|
|
68 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
69 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
70 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
71 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
72 |
</com:TListBox>
|
|
|
73 |
<com:TLabel ID="SelectionResult" ForeColor="red" />
|
|
|
74 |
</td>
|
|
|
75 |
</tr>
|
|
|
76 |
|
|
|
77 |
<tr>
|
|
|
78 |
<td class="samplenote">
|
|
|
79 |
List box's behavior upon postback:
|
|
|
80 |
</td>
|
|
|
81 |
<td class="sampleaction">
|
|
|
82 |
<com:TListBox ID="ListBox1">
|
|
|
83 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
84 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
85 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
86 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
87 |
</com:TListBox>
|
|
|
88 |
<com:TButton Text="Submit" OnClick="buttonClicked"/>
|
|
|
89 |
<com:TLabel ID="SelectionResult2" ForeColor="red" />
|
|
|
90 |
</td>
|
|
|
91 |
</tr>
|
|
|
92 |
|
|
|
93 |
</table>
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
<h2>List Boxes in Multiple Selection Mode</h2>
|
|
|
97 |
<i>Use Ctrl + Mouse Click to change selection</i>
|
|
|
98 |
<br/>
|
|
|
99 |
|
|
|
100 |
<table class="sampletable">
|
|
|
101 |
|
|
|
102 |
<tr>
|
|
|
103 |
<td class="samplenote">
|
|
|
104 |
List box with default settings:
|
|
|
105 |
</td>
|
|
|
106 |
<td class="sampleaction">
|
|
|
107 |
<com:TListBox SelectionMode="Multiple" />
|
|
|
108 |
</td>
|
|
|
109 |
</tr>
|
|
|
110 |
|
|
|
111 |
<tr>
|
|
|
112 |
<td class="samplenote">
|
|
|
113 |
List box with initial items:
|
|
|
114 |
</td>
|
|
|
115 |
<td class="sampleaction">
|
|
|
116 |
<com:TListBox SelectionMode="Multiple">
|
|
|
117 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
118 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
119 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
120 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
121 |
</com:TListBox>
|
|
|
122 |
</td>
|
|
|
123 |
</tr>
|
|
|
124 |
|
|
|
125 |
<tr>
|
|
|
126 |
<td class="samplenote">
|
|
|
127 |
List box's behavior upon postback:
|
|
|
128 |
</td>
|
|
|
129 |
<td class="sampleaction">
|
|
|
130 |
<com:TListBox ID="ListBox2" SelectionMode="Multiple">
|
|
|
131 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
132 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
133 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
134 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
135 |
</com:TListBox>
|
|
|
136 |
<com:TButton Text="Submit" OnClick="buttonClicked2" />
|
|
|
137 |
<br/>
|
|
|
138 |
<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
|
|
|
139 |
</td>
|
|
|
140 |
</tr>
|
|
|
141 |
|
|
|
142 |
<tr>
|
|
|
143 |
<td class="samplenote">
|
|
|
144 |
Auto postback list box:
|
|
|
145 |
</td>
|
|
|
146 |
<td class="sampleaction">
|
|
|
147 |
<com:TListBox AutoPostBack="true"
|
|
|
148 |
SelectionMode="Multiple"
|
|
|
149 |
OnSelectedIndexChanged="multiSelectionChanged">
|
|
|
150 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
151 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
152 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
153 |
<com:TListItem Value="value 4" Text="item 4" Selected="true" />
|
|
|
154 |
</com:TListBox>
|
|
|
155 |
<com:TLabel ID="MultiSelectionResult" ForeColor="red" />
|
|
|
156 |
</td>
|
|
|
157 |
</tr>
|
|
|
158 |
|
|
|
159 |
</table>
|
|
|
160 |
|
|
|
161 |
<h2>List Boxes with DataBinding</h2>
|
|
|
162 |
<i>Use Ctrl + Mouse Click to change selection</i>
|
|
|
163 |
<br/>
|
|
|
164 |
|
|
|
165 |
<table class="sampletable">
|
|
|
166 |
|
|
|
167 |
<tr>
|
|
|
168 |
<td class="samplenote">
|
|
|
169 |
Databind to an integer-indexed array:
|
|
|
170 |
</td>
|
|
|
171 |
<td class="sampleaction">
|
|
|
172 |
<com:TListBox ID="DBListBox1"
|
|
|
173 |
AutoPostBack="true"
|
|
|
174 |
SelectionMode="Multiple"
|
|
|
175 |
OnSelectedIndexChanged="DBListBox1Changed" />
|
|
|
176 |
<com:TLabel ID="DBListBox1Result" ForeColor="red" />
|
|
|
177 |
</td>
|
|
|
178 |
</tr>
|
|
|
179 |
|
|
|
180 |
<tr>
|
|
|
181 |
<td class="samplenote">
|
|
|
182 |
Databind to an associative array:
|
|
|
183 |
</td>
|
|
|
184 |
<td class="sampleaction">
|
|
|
185 |
<com:TListBox ID="DBListBox2"
|
|
|
186 |
AutoPostBack="true"
|
|
|
187 |
SelectionMode="Multiple"
|
|
|
188 |
OnSelectedIndexChanged="DBListBox2Changed" />
|
|
|
189 |
<com:TLabel ID="DBListBox2Result" ForeColor="red" />
|
|
|
190 |
</td>
|
|
|
191 |
</tr>
|
|
|
192 |
|
|
|
193 |
<tr>
|
|
|
194 |
<td class="samplenote">
|
|
|
195 |
Databind with DataTextField and DataValueField specified:
|
|
|
196 |
</td>
|
|
|
197 |
<td class="sampleaction">
|
|
|
198 |
<com:TListBox ID="DBListBox3"
|
|
|
199 |
AutoPostBack="true"
|
|
|
200 |
SelectionMode="Multiple"
|
|
|
201 |
DataTextField="name"
|
|
|
202 |
DataValueField="id"
|
|
|
203 |
OnSelectedIndexChanged="DBListBox3Changed" />
|
|
|
204 |
<com:TLabel ID="DBListBox3Result" ForeColor="red" />
|
|
|
205 |
</td>
|
|
|
206 |
</tr>
|
|
|
207 |
|
|
|
208 |
</table>
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
<h2>List Boxes with Validation</h2>
|
|
|
212 |
|
|
|
213 |
<table class="sampletable">
|
|
|
214 |
|
|
|
215 |
<tr>
|
|
|
216 |
<td class="samplenote">
|
|
|
217 |
List box is being validated:
|
|
|
218 |
</td>
|
|
|
219 |
<td class="sampleaction">
|
|
|
220 |
<com:TListBox ID="VListBox1">
|
|
|
221 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
222 |
<com:TListItem Value="value 2" Text="item 2" />
|
|
|
223 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
224 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
225 |
</com:TListBox>
|
|
|
226 |
<com:TRequiredFieldValidator
|
|
|
227 |
ControlToValidate="VListBox1"
|
|
|
228 |
ErrorMessage="You must make a selection"
|
|
|
229 |
Display="Dynamic"
|
|
|
230 |
ValidationGroup="Group1"
|
|
|
231 |
/>
|
|
|
232 |
<com:TButton Text="Submit" ValidationGroup="Group1" />
|
|
|
233 |
</td>
|
|
|
234 |
</tr>
|
|
|
235 |
|
|
|
236 |
<tr>
|
|
|
237 |
<td class="samplenote">
|
|
|
238 |
List box causing validation:
|
|
|
239 |
</td>
|
|
|
240 |
<td class="sampleaction">
|
|
|
241 |
<com:TTextBox ID="TextBox" />
|
|
|
242 |
<com:TRequiredFieldValidator
|
|
|
243 |
ControlToValidate="TextBox"
|
|
|
244 |
ErrorMessage="You must enter a value"
|
|
|
245 |
Display="Dynamic"
|
|
|
246 |
ValidationGroup="Group2"
|
|
|
247 |
/>
|
|
|
248 |
<com:TListBox
|
|
|
249 |
ID="VListBox2"
|
|
|
250 |
AutoPostBack="true"
|
|
|
251 |
ValidationGroup="Group2">
|
|
|
252 |
<com:TListItem Text="Agree" />
|
|
|
253 |
<com:TListItem Text="Disagree" />
|
|
|
254 |
</com:TListBox>
|
|
|
255 |
</td>
|
|
|
256 |
</tr>
|
|
|
257 |
|
|
|
258 |
<tr>
|
|
|
259 |
<td class="samplenote">
|
|
|
260 |
List box with option groups:
|
|
|
261 |
</td>
|
|
|
262 |
<td class="sampleaction">
|
|
|
263 |
<com:TListBox>
|
|
|
264 |
<com:TListItem Value="value 1" Text="item 1" Attributes.Group="group 1"/>
|
|
|
265 |
<com:TListItem Value="value 2" Text="item 2" Attributes.Group="group 1"/>
|
|
|
266 |
<com:TListItem Value="value 3" Text="item 3" Attributes.Group="group 2"/>
|
|
|
267 |
<com:TListItem Value="value 4" Text="item 4" Attributes.Group="group 2"/>
|
|
|
268 |
</com:TListBox>
|
|
|
269 |
</td>
|
|
|
270 |
</tr>
|
|
|
271 |
|
|
|
272 |
</table>
|
|
|
273 |
|
|
|
274 |
<div class="last-modified">$Id: Home.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
|