summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.page
blob: 7a9dd3b7220c74d62252269858c9c8eec668b540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<com:TContent ID="body">

<h1>TListBox Samples</h1>

<h2>List Boxes in Single Selection Mode</h2>

<table class="sampletable">

<tr>
<td class="samplenote">
List box with default settings:
</td>
<td class="sampleaction">
<com:TListBox />
</td>
</tr>

<tr>
<td class="samplenote">
List box with initial items:
</td>
<td class="sampleaction">
<com:TListBox>
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" />
</com:TListBox>
</td>
</tr>

<tr>
<td class="samplenote">
List box with customized row number, color and font:
</td>
<td class="sampleaction">
<com:TListBox Rows="3" ForeColor="blue" Font.Size="14pt">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" />
</com:TListBox>
</td>
</tr>

<tr>
<td class="samplenote">
Disabled list box:
</td>
<td class="sampleaction">
<com:TListBox Enabled="false">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" />
</com:TListBox>
</td>
</tr>

<tr>
<td class="samplenote">
Auto postback list box:
</td>
<td class="sampleaction">
<com:TListBox
	AutoPostBack="true"
	OnSelectedIndexChanged="selectionChanged">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" />
</com:TListBox>
<com:TLabel ID="SelectionResult" ForeColor="red" />
</td>
</tr>

<tr>
<td class="samplenote">
List box's behavior upon postback:
</td>
<td class="sampleaction">
<com:TListBox ID="ListBox1">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" />
</com:TListBox>
<com:TButton Text="Submit" OnClick="buttonClicked"/>
<com:TLabel ID="SelectionResult2" ForeColor="red" />
</td>
</tr>

</table>


<h2>List Boxes in Multiple Selection Mode</h2>
<i>Use Ctrl + Mouse Click to change selection</i>
<br/>

<table class="sampletable">

<tr>
<td class="samplenote">
List box with default settings:
</td>
<td class="sampleaction">
<com:TListBox SelectionMode="Multiple" />
</td>
</tr>

<tr>
<td class="samplenote">
List box with initial items:
</td>
<td class="sampleaction">
<com:TListBox SelectionMode="Multiple">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" Selected="true" />
</com:TListBox>
</td>
</tr>

<tr>
<td class="samplenote">
List box's behavior upon postback:
</td>
<td class="sampleaction">
<com:TListBox ID="ListBox2" SelectionMode="Multiple">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" Selected="true" />
</com:TListBox>
<com:TButton Text="Submit" OnClick="buttonClicked2" />
<br/>
<com:TLabel ID="MultiSelectionResult2" ForeColor="red" />
</td>
</tr>

<tr>
<td class="samplenote">
Auto postback list box:
</td>
<td class="sampleaction">
<com:TListBox AutoPostBack="true"
	SelectionMode="Multiple"
	OnSelectedIndexChanged="multiSelectionChanged">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" Selected="true" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" Selected="true" />
</com:TListBox>
<com:TLabel ID="MultiSelectionResult" ForeColor="red" />
</td>
</tr>

</table>

<h2>List Boxes with DataBinding</h2>
<i>Use Ctrl + Mouse Click to change selection</i>
<br/>

<table class="sampletable">

<tr>
<td class="samplenote">
Databind to an integer-indexed array:
</td>
<td class="sampleaction">
<com:TListBox ID="DBListBox1"
	AutoPostBack="true"
	SelectionMode="Multiple"
	OnSelectedIndexChanged="DBListBox1Changed" />
<com:TLabel ID="DBListBox1Result" ForeColor="red" />
</td>
</tr>

<tr>
<td class="samplenote">
Databind to an associative array:
</td>
<td class="sampleaction">
<com:TListBox ID="DBListBox2"
	AutoPostBack="true"
	SelectionMode="Multiple"
	OnSelectedIndexChanged="DBListBox2Changed" />
<com:TLabel ID="DBListBox2Result" ForeColor="red" />
</td>
</tr>

<tr>
<td class="samplenote">
Databind with DataTextField and DataValueField specified:
</td>
<td class="sampleaction">
<com:TListBox ID="DBListBox3"
	AutoPostBack="true"
	SelectionMode="Multiple"
	DataTextField="name"
	DataValueField="id"
	OnSelectedIndexChanged="DBListBox3Changed" />
<com:TLabel ID="DBListBox3Result" ForeColor="red" />
</td>
</tr>

</table>


<h2>List Boxes with Validation</h2>

<table class="sampletable">

<tr>
<td class="samplenote">
List box is being validated:
</td>
<td class="sampleaction">
<com:TListBox ID="VListBox1">
  <com:TListItem Value="value 1" Text="item 1" />
  <com:TListItem Value="value 2" Text="item 2" />
  <com:TListItem Value="value 3" Text="item 3" />
  <com:TListItem Value="value 4" Text="item 4" />
</com:TListBox>
<com:TRequiredFieldValidator
	ControlToValidate="VListBox1"
	ErrorMessage="You must make a selection"
	Display="Dynamic"
	ValidationGroup="Group1"
	/>
<com:TButton Text="Submit" ValidationGroup="Group1" />
</td>
</tr>

<tr>
<td class="samplenote">
List box causing validation:
</td>
<td class="sampleaction">
<com:TTextBox ID="TextBox" />
<com:TRequiredFieldValidator
	ControlToValidate="TextBox"
	ErrorMessage="You must enter a value"
	Display="Dynamic"
	ValidationGroup="Group2"
	/>
<com:TListBox
	ID="VListBox2"
	AutoPostBack="true"
	ValidationGroup="Group2">
  <com:TListItem Text="Agree" />
  <com:TListItem Text="Disagree" />
</com:TListBox>
</td>
</tr>

<tr>
<td class="samplenote">
List box with option groups:
</td>
<td class="sampleaction">
<com:TListBox>
  <com:TListItem Value="value 1" Text="item 1" Attributes.Group="group 1"/>
  <com:TListItem Value="value 2" Text="item 2" Attributes.Group="group 1"/>
  <com:TListItem Value="value 3" Text="item 3" Attributes.Group="group 2"/>
  <com:TListItem Value="value 4" Text="item 4" Attributes.Group="group 2"/>
</com:TListBox>
</td>
</tr>

</table>

</com:TContent>