| 1 |
lars |
1 |
<com:TContent ID="body">
|
|
|
2 |
|
|
|
3 |
<h1>TDropDownList Samples</h1>
|
|
|
4 |
|
|
|
5 |
<table class="sampletable">
|
|
|
6 |
|
|
|
7 |
<tr>
|
|
|
8 |
<td class="samplenote">
|
|
|
9 |
Dropdown list with default settings:
|
|
|
10 |
</td>
|
|
|
11 |
<td class="sampleaction">
|
|
|
12 |
<com:TDropDownList />
|
|
|
13 |
</td>
|
|
|
14 |
</tr>
|
|
|
15 |
|
|
|
16 |
<tr>
|
|
|
17 |
<td class="samplenote">
|
|
|
18 |
Dropdown list with initial items:
|
|
|
19 |
</td>
|
|
|
20 |
<td class="sampleaction">
|
|
|
21 |
<com:TDropDownList>
|
|
|
22 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
23 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
24 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
25 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
26 |
</com:TDropDownList>
|
|
|
27 |
</td>
|
|
|
28 |
</tr>
|
|
|
29 |
|
|
|
30 |
<tr>
|
|
|
31 |
<td class="samplenote">
|
|
|
32 |
List box with customized row number, color and font:
|
|
|
33 |
</td>
|
|
|
34 |
<td class="sampleaction">
|
|
|
35 |
<com:TDropDownList ForeColor="blue" Font.Size="14pt">
|
|
|
36 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
37 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
38 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
39 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
40 |
</com:TDropDownList>
|
|
|
41 |
</td>
|
|
|
42 |
</tr>
|
|
|
43 |
|
|
|
44 |
<tr>
|
|
|
45 |
<td class="samplenote">
|
|
|
46 |
Disabled dropdown list:
|
|
|
47 |
</td>
|
|
|
48 |
<td class="sampleaction">
|
|
|
49 |
<com:TDropDownList Enabled="false">
|
|
|
50 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
51 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
52 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
53 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
54 |
</com:TDropDownList>
|
|
|
55 |
</td>
|
|
|
56 |
</tr>
|
|
|
57 |
|
|
|
58 |
<tr>
|
|
|
59 |
<td class="samplenote">
|
|
|
60 |
Auto postback dropdown list:
|
|
|
61 |
</td>
|
|
|
62 |
<td class="sampleaction">
|
|
|
63 |
<com:TDropDownList
|
|
|
64 |
AutoPostBack="true"
|
|
|
65 |
OnSelectedIndexChanged="selectionChanged">
|
|
|
66 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
67 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
68 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
69 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
70 |
</com:TDropDownList>
|
|
|
71 |
<com:TLabel ID="SelectionResult" ForeColor="red" />
|
|
|
72 |
</td>
|
|
|
73 |
</tr>
|
|
|
74 |
|
|
|
75 |
<tr>
|
|
|
76 |
<td class="samplenote">
|
|
|
77 |
Dropdown list's behavior upon postback:
|
|
|
78 |
</td>
|
|
|
79 |
<td class="sampleaction">
|
|
|
80 |
<com:TDropDownList ID="DropDownList1">
|
|
|
81 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
82 |
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
|
|
|
83 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
84 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
85 |
</com:TDropDownList>
|
|
|
86 |
<com:TButton Text="Submit" OnClick="buttonClicked"/>
|
|
|
87 |
<com:TLabel ID="SelectionResult2" ForeColor="red" />
|
|
|
88 |
</td>
|
|
|
89 |
</tr>
|
|
|
90 |
|
|
|
91 |
</table>
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
<h2>DropDown Lists with DataBinding</h2>
|
|
|
95 |
|
|
|
96 |
<table class="sampletable">
|
|
|
97 |
|
|
|
98 |
<tr>
|
|
|
99 |
<td class="samplenote">
|
|
|
100 |
Databind to an integer-indexed array:
|
|
|
101 |
</td>
|
|
|
102 |
<td class="sampleaction">
|
|
|
103 |
<com:TDropDownList ID="DBDropDownList1"
|
|
|
104 |
AutoPostBack="true"
|
|
|
105 |
OnSelectedIndexChanged="DBDropDownList1Changed" />
|
|
|
106 |
<com:TLabel ID="DBDropDownList1Result" ForeColor="red" />
|
|
|
107 |
</td>
|
|
|
108 |
</tr>
|
|
|
109 |
|
|
|
110 |
<tr>
|
|
|
111 |
<td class="samplenote">
|
|
|
112 |
Databind to an associative array:
|
|
|
113 |
</td>
|
|
|
114 |
<td class="sampleaction">
|
|
|
115 |
<com:TDropDownList ID="DBDropDownList2"
|
|
|
116 |
AutoPostBack="true"
|
|
|
117 |
OnSelectedIndexChanged="DBDropDownList2Changed" />
|
|
|
118 |
<com:TLabel ID="DBDropDownList2Result" ForeColor="red" />
|
|
|
119 |
</td>
|
|
|
120 |
</tr>
|
|
|
121 |
|
|
|
122 |
<tr>
|
|
|
123 |
<td class="samplenote">
|
|
|
124 |
Databind with DataTextField and DataValueField specified:
|
|
|
125 |
</td>
|
|
|
126 |
<td class="sampleaction">
|
|
|
127 |
<com:TDropDownList ID="DBDropDownList3"
|
|
|
128 |
AutoPostBack="true"
|
|
|
129 |
DataTextField="name"
|
|
|
130 |
DataValueField="id"
|
|
|
131 |
OnSelectedIndexChanged="DBDropDownList3Changed" />
|
|
|
132 |
<com:TLabel ID="DBDropDownList3Result" ForeColor="red" />
|
|
|
133 |
</td>
|
|
|
134 |
</tr>
|
|
|
135 |
|
|
|
136 |
</table>
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
<h2>List Boxes with Validation</h2>
|
|
|
140 |
|
|
|
141 |
<table class="sampletable">
|
|
|
142 |
|
|
|
143 |
<tr>
|
|
|
144 |
<td class="samplenote">
|
|
|
145 |
Dropdown list is being validated:
|
|
|
146 |
</td>
|
|
|
147 |
<td class="sampleaction">
|
|
|
148 |
<com:TDropDownList ID="VDropDownList1">
|
|
|
149 |
<com:TListItem Value="value 1" Text="item 1" />
|
|
|
150 |
<com:TListItem Value="value 2" Text="item 2" />
|
|
|
151 |
<com:TListItem Value="value 3" Text="item 3" />
|
|
|
152 |
<com:TListItem Value="value 4" Text="item 4" />
|
|
|
153 |
</com:TDropDownList>
|
|
|
154 |
<com:TRequiredFieldValidator
|
|
|
155 |
ControlToValidate="VDropDownList1"
|
|
|
156 |
ErrorMessage="You must make a selection other than the first option"
|
|
|
157 |
InitialValue="value 1"
|
|
|
158 |
Display="Dynamic"
|
|
|
159 |
ValidationGroup="Group1"
|
|
|
160 |
/>
|
|
|
161 |
<com:TButton Text="Submit" ValidationGroup="Group1" />
|
|
|
162 |
</td>
|
|
|
163 |
</tr>
|
|
|
164 |
|
|
|
165 |
<tr>
|
|
|
166 |
<td class="samplenote">
|
|
|
167 |
Dropdown list causing validation:
|
|
|
168 |
</td>
|
|
|
169 |
<td class="sampleaction">
|
|
|
170 |
<com:TTextBox ID="TextBox" />
|
|
|
171 |
<com:TRequiredFieldValidator
|
|
|
172 |
ControlToValidate="TextBox"
|
|
|
173 |
ErrorMessage="You must enter a value"
|
|
|
174 |
Display="Dynamic"
|
|
|
175 |
ValidationGroup="Group2"
|
|
|
176 |
/>
|
|
|
177 |
<com:TDropDownList
|
|
|
178 |
ID="VDropDownList2"
|
|
|
179 |
AutoPostBack="true"
|
|
|
180 |
ValidationGroup="Group2">
|
|
|
181 |
<com:TListItem Text="Agree" />
|
|
|
182 |
<com:TListItem Text="Disagree" />
|
|
|
183 |
</com:TDropDownList>
|
|
|
184 |
</td>
|
|
|
185 |
</tr>
|
|
|
186 |
|
|
|
187 |
<tr>
|
|
|
188 |
<td class="samplenote">
|
|
|
189 |
Dropdown list with option groups:
|
|
|
190 |
</td>
|
|
|
191 |
<td class="sampleaction">
|
|
|
192 |
<com:TDropDownList>
|
|
|
193 |
<com:TListItem Value="value 1" Text="item 1" Attributes.Group="group 1"/>
|
|
|
194 |
<com:TListItem Value="value 2" Text="item 2" Attributes.Group="group 1"/>
|
|
|
195 |
<com:TListItem Value="value 3" Text="item 3" Attributes.Group="group 2"/>
|
|
|
196 |
<com:TListItem Value="value 4" Text="item 4" Attributes.Group="group 2"/>
|
|
|
197 |
</com:TDropDownList>
|
|
|
198 |
</td>
|
|
|
199 |
</tr>
|
|
|
200 |
|
|
|
201 |
</table>
|
|
|
202 |
|
|
|
203 |
<div class="last-modified">$Id: Home.page 1650 2007-01-24 06:55:32Z wei $</div></com:TContent>
|