質問編集履歴
1
実装の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -78,81 +78,201 @@
|
|
78
78
|
|
79
79
|
###試したこと
|
80
80
|
|
81
|
-
これを実現するために以下のようなイメージで動的に画面を作ることを考えています
|
81
|
+
これを実現するために以下のようなイメージで動的に画面を作ることを考えています。
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
```vbnet
|
86
|
+
|
87
|
+
<ajaxToolkit:Accordion>
|
88
|
+
|
89
|
+
<Panes>
|
90
|
+
|
91
|
+
<ajaxToolkit:AccordionPane>
|
92
|
+
|
93
|
+
<Header>
|
94
|
+
|
95
|
+
<table> 中分類
|
96
|
+
|
97
|
+
</Header>
|
98
|
+
|
99
|
+
<Content>
|
100
|
+
|
101
|
+
<asp:GridView> 小分類
|
102
|
+
|
103
|
+
</Content>
|
104
|
+
|
105
|
+
</ajaxToolkit:AccordionPane>
|
106
|
+
|
107
|
+
</Panes>
|
108
|
+
|
109
|
+
</ajaxToolkit:Accordion>
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
上記のアコーディオンを大項目のアコーディオンに入れる
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
```vbnet
|
120
|
+
|
121
|
+
<ajaxToolkit:Accordion>
|
122
|
+
|
123
|
+
<Panes>
|
124
|
+
|
125
|
+
<ajaxToolkit:AccordionPane>
|
126
|
+
|
127
|
+
<Header>
|
128
|
+
|
129
|
+
<table> 大分類
|
130
|
+
|
131
|
+
</Header>
|
132
|
+
|
133
|
+
<Content>
|
134
|
+
|
135
|
+
<ajaxToolkit:Accordion> 中分類1
|
136
|
+
|
137
|
+
<ajaxToolkit:Accordion> 中分類2
|
138
|
+
|
139
|
+
<ajaxToolkit:Accordion> 中分類3
|
140
|
+
|
141
|
+
</Content>
|
142
|
+
|
143
|
+
</ajaxToolkit:AccordionPane>
|
144
|
+
|
145
|
+
</Panes>
|
146
|
+
|
147
|
+
</ajaxToolkit:Accordion>
|
148
|
+
|
149
|
+
```
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
これを実現するために以下のようなプログラムを書きました。
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
```vbnet
|
158
|
+
|
159
|
+
Private Sub SetContents(ByVal control As ControlCollection, ByVal header As DataRow, ByVal content As DataTable)
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
Dim accordion As AjaxControlToolkit.Accordion
|
164
|
+
|
165
|
+
Dim accordionPane As AjaxControlToolkit.AccordionPane
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
Dim table As Table
|
170
|
+
|
171
|
+
Dim tableRow As TableRow
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
Try
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
' Accordion Header
|
180
|
+
|
181
|
+
table = New Table
|
182
|
+
|
183
|
+
tableRow = CreateRow(header) ' TableRowを生成する関数(省略)
|
184
|
+
|
185
|
+
table.Controls.Add(tableRow)
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
contentRows = content.Select(pattern) ' patternは抽出条件(省略)
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
If (contentRows.Length = 0) Then
|
194
|
+
|
195
|
+
' コンテンツなし
|
196
|
+
|
197
|
+
control.Add(table)
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
Else
|
202
|
+
|
203
|
+
' コンテンツあり
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
accordion = New AjaxControlToolkit.Accordion
|
208
|
+
|
209
|
+
accordion.ID = "accordion_" + header("xxx")
|
210
|
+
|
211
|
+
accordion.ContentCssClass = "accordionContent"
|
212
|
+
|
213
|
+
accordion.HeaderCssClass = "accordionHeader"
|
214
|
+
|
215
|
+
accordion.RequireOpenedPane = False
|
216
|
+
|
217
|
+
accordionPane = New AjaxControlToolkit.AccordionPane
|
218
|
+
|
219
|
+
accordionPane.ID = "accordionPane_" + header("xxx")
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
' ヘッダー追加
|
224
|
+
|
225
|
+
accordionPane.HeaderContainer.Controls.Add(table)
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
' コンテンツの追加は、再帰呼出しによって行う
|
230
|
+
|
231
|
+
For Each row As DataRow In contentRows
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
SetContents(accordionPane.ContentContainer.Controls, row, content)
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
Next
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
' ペインの追加
|
244
|
+
|
245
|
+
accordion.Panes.Add(accordionPane)
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
' 作成したアコーディオンを追加する
|
250
|
+
|
251
|
+
control.Add(accordion)
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
End If
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
Catch ex As Exception
|
260
|
+
|
261
|
+
Throw
|
262
|
+
|
263
|
+
End Try
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
End Sub
|
268
|
+
|
269
|
+
```
|
270
|
+
|
271
|
+
|
82
272
|
|
83
273
|
より良い方法がございましたらご教授いただければ幸いです。
|
84
274
|
|
85
|
-
|
86
|
-
|
87
|
-
```vbnet
|
88
|
-
|
89
|
-
<ajaxToolkit:Accordion>
|
90
|
-
|
91
|
-
<Panes>
|
92
|
-
|
93
|
-
<ajaxToolkit:AccordionPane>
|
94
|
-
|
95
|
-
<Header>
|
96
|
-
|
97
|
-
<table> 中分類
|
98
|
-
|
99
|
-
</Header>
|
100
|
-
|
101
|
-
<Content>
|
102
|
-
|
103
|
-
<asp:GridView> 小分類
|
104
|
-
|
105
|
-
</Content>
|
106
|
-
|
107
|
-
</ajaxToolkit:AccordionPane>
|
108
|
-
|
109
|
-
</Panes>
|
110
|
-
|
111
|
-
</ajaxToolkit:Accordion>
|
112
|
-
|
113
|
-
```
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
上記のアコーディオンを大項目のアコーディオンに入れる
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
```vbnet
|
122
|
-
|
123
|
-
<ajaxToolkit:Accordion>
|
124
|
-
|
125
|
-
<Panes>
|
126
|
-
|
127
|
-
<ajaxToolkit:AccordionPane>
|
128
|
-
|
129
|
-
<Header>
|
130
|
-
|
131
|
-
<table> 大分類
|
132
|
-
|
133
|
-
</Header>
|
134
|
-
|
135
|
-
<Content>
|
136
|
-
|
137
|
-
<ajaxToolkit:Accordion> 中分類1
|
138
|
-
|
139
|
-
<ajaxToolkit:Accordion> 中分類2
|
140
|
-
|
141
|
-
<ajaxToolkit:Accordion> 中分類3
|
142
|
-
|
143
|
-
</Content>
|
144
|
-
|
145
|
-
</ajaxToolkit:AccordionPane>
|
146
|
-
|
147
|
-
</Panes>
|
148
|
-
|
149
|
-
</ajaxToolkit:Accordion>
|
150
|
-
|
151
|
-
```
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
275
|
+
よろしくお願いいたします。
|
156
276
|
|
157
277
|
|
158
278
|
|