質問編集履歴
6
タイトル、記述の一部修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
FormViewで表示されるラベルコントロールの内容を
|
1
|
+
FormViewで表示されるラベルコントロールの内容を別ページのDropDownListのデフォルト選択肢に反映させたいです。
|
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
以下のような
|
11
|
+
以下のような過去の回答一覧が格納されるテーブル(わかりやすいようにレコードはひとつだけですが、本来は複数格納され、ひとつのカード画面にひとつの回答一覧、という具合です)をコントロールを用いて表示します。
|
12
12
|
|
13
13
|

|
14
14
|
|
@@ -26,13 +26,17 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
+
「編集」ボタンをおすと(ボタンはItemTemplateに設置)、以下のような回答ページにとびます(別ページ)。
|
30
|
+
|
29
|
-
]
|
30
|
-
|
32
|
+
|
33
|
+
|
34
|
+
|
31
|
-
|
35
|
+
この際、遷移前のフォームビューの回答一覧を遷移後の回答ドロップダウンリストの選択肢に反映させることはできないでしょうか。
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
|
37
|
+
|
38
|
+
|
35
|
-
たとえば、FormViewでの表示が「はい」なら、ドロップダウンリストでデフォルト選択されているのも「はい」
|
39
|
+
たとえば、FormViewでの表示が「はい」なら、ドロップダウンリストでデフォルト選択されているのも「はい」といった具合です。
|
36
40
|
|
37
41
|
|
38
42
|
|
@@ -46,13 +50,9 @@
|
|
46
50
|
|
47
51
|
|
48
52
|
|
49
|
-
※9/
|
53
|
+
※9/11 追記
|
50
|
-
|
54
|
+
|
51
|
-
|
55
|
+
フォームビューのボタンがクリックされた段階で、フォームビューに回答を表示させるためのラベルの値を読み取り、セッション変数に格納するやり方を考えています。
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
回答と一緒に回答点数の値も同時に算出・格納しなければならず、ItemInsertingプロシージャ内で処理を記述するよりは、新規登録フォームを別ページに設定したほうがよいかと思いましたので、その場合は単純なラベルコントロールの内容を反映するというよりは、フォームビューの表示内容(ラベル)を読み取って別ページへのデータの受け渡しといった問題になるのでしょうか。
|
56
56
|
|
57
57
|
|
58
58
|
|
5
追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
FormViewで表示
|
1
|
+
FormViewで表示されるラベルコントロールの内容を新規登録用DropDownListのデフォルト選択肢に反映させたいです。
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
ASP.NET Webフォームアプリに関する質問です。
|
2
2
|
|
3
|
-
|
3
|
+
過去の回答をもとに新しい回答が可能な質問回答機能を考えています。
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
以下のような内容のテーブル(過去の回答を格納)をFormViewコントロールを用いて表示します。
|
11
|
+
以下のような内容のテーブル(過去の回答を格納、わかりやすいようにレコードはひとつだけですが、本来は複数格納されます)をFormViewコントロールを用いて表示します。
|
12
12
|
|
13
13
|

|
14
14
|
|
@@ -48,206 +48,202 @@
|
|
48
48
|
|
49
49
|
※9/9 追記
|
50
50
|
|
51
|
+
当初は単純にFormViewのEditTemplateで反映予定だったのですが、データの上書きではなく、新規登録フォームのドロップダウンリストへ反映させなければならなくなりました(新規登録フォームも編集モードのそれと同じです)。
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
回答と一緒に回答点数の値も同時に算出・格納しなければならず、ItemInsertingプロシージャ内で処理を記述するよりは、新規登録フォームを別ページに設定したほうがよいかと思いましたので、その場合は単純なラベルコントロールの内容を反映するというよりは、フォームビューの表示内容(ラベル)を読み取って別ページへのデータの受け渡しといった問題になるのでしょうか。
|
56
|
+
|
57
|
+
|
58
|
+
|
51
|
-
|
59
|
+
過去回答テーブルには複数の回答一覧が格納されるため、初期(デフォルト)選択肢は固定でない方が望ましいです。
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<全体(フォームビューのものです)>
|
52
64
|
|
53
65
|
```ここに言語を入力
|
54
66
|
|
67
|
+
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID"
|
68
|
+
|
69
|
+
DataSourceID="SqlDataSource1" AllowPaging="True">
|
70
|
+
|
71
|
+
<EditItemTemplate>
|
72
|
+
|
73
|
+
<br />
|
74
|
+
|
75
|
+
<table cellpadding="0" cellspacing="0" class="style3">
|
76
|
+
|
77
|
+
<tr>
|
78
|
+
|
79
|
+
<td>
|
80
|
+
|
81
|
+
ID</td>
|
82
|
+
|
83
|
+
<td>
|
84
|
+
|
85
|
+
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
86
|
+
|
87
|
+
</td>
|
88
|
+
|
89
|
+
</tr>
|
90
|
+
|
91
|
+
<tr>
|
92
|
+
|
93
|
+
<td class="style4">
|
94
|
+
|
95
|
+
Result1</td>
|
96
|
+
|
97
|
+
<td class="style4">
|
98
|
+
|
99
|
+
<asp:DropDownList ID="DropDownList1" runat="server"
|
100
|
+
|
55
|
-
SelectedValue='<%# Bind("result1") %>'
|
101
|
+
SelectedValue='<%# Bind("result1") %>'>
|
102
|
+
|
103
|
+
<asp:ListItem>はい</asp:ListItem>
|
104
|
+
|
105
|
+
<asp:ListItem>いいえ</asp:ListItem>
|
106
|
+
|
107
|
+
<asp:ListItem>未回答</asp:ListItem>
|
108
|
+
|
109
|
+
</asp:DropDownList>
|
110
|
+
|
111
|
+
</td>
|
112
|
+
|
113
|
+
</tr>
|
114
|
+
|
115
|
+
'ドロップダウンリスト5つ分
|
116
|
+
|
117
|
+
</table>
|
118
|
+
|
119
|
+
<br />
|
120
|
+
|
121
|
+
<asp:Button ID="Button2" runat="server" CommandName="Update" Text="登録" />
|
122
|
+
|
123
|
+
<asp:Button ID="Button3" runat="server" CommandName="Cancel" Text="キャンセル" />
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</EditItemTemplate>
|
128
|
+
|
129
|
+
<ItemTemplate>
|
130
|
+
|
131
|
+
<br />
|
132
|
+
|
133
|
+
<table cellpadding="0" cellspacing="0" class="style3">
|
134
|
+
|
135
|
+
<tr>
|
136
|
+
|
137
|
+
<td>
|
138
|
+
|
139
|
+
ID</td>
|
140
|
+
|
141
|
+
<td>
|
142
|
+
|
143
|
+
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
144
|
+
|
145
|
+
</td>
|
146
|
+
|
147
|
+
</tr>
|
148
|
+
|
149
|
+
<tr>
|
150
|
+
|
151
|
+
<td>
|
152
|
+
|
153
|
+
Result1</td>
|
154
|
+
|
155
|
+
<td>
|
156
|
+
|
157
|
+
<asp:Label ID="result1Label" runat="server" Text='<%# Bind("result1") %>' />
|
158
|
+
|
159
|
+
</td>
|
160
|
+
|
161
|
+
</tr>
|
162
|
+
|
163
|
+
<tr>
|
164
|
+
|
165
|
+
<td>
|
166
|
+
|
167
|
+
Result2</td>
|
168
|
+
|
169
|
+
<td>
|
170
|
+
|
171
|
+
<asp:Label ID="result2Label" runat="server" Text='<%# Bind("result2") %>' />
|
172
|
+
|
173
|
+
</td>
|
174
|
+
|
175
|
+
</tr>
|
176
|
+
|
177
|
+
<tr>
|
178
|
+
|
179
|
+
<td>
|
180
|
+
|
181
|
+
Result3</td>
|
182
|
+
|
183
|
+
<td>
|
184
|
+
|
185
|
+
<asp:Label ID="result3Label" runat="server" Text='<%# Bind("result3") %>' />
|
186
|
+
|
187
|
+
</td>
|
188
|
+
|
189
|
+
</tr>
|
190
|
+
|
191
|
+
<tr>
|
192
|
+
|
193
|
+
<td>
|
194
|
+
|
195
|
+
Result4</td>
|
196
|
+
|
197
|
+
<td>
|
198
|
+
|
199
|
+
<asp:Label ID="result4Label" runat="server" Text='<%# Bind("result4") %>' />
|
200
|
+
|
201
|
+
</td>
|
202
|
+
|
203
|
+
</tr>
|
204
|
+
|
205
|
+
<tr>
|
206
|
+
|
207
|
+
<td>
|
208
|
+
|
209
|
+
Result5</td>
|
210
|
+
|
211
|
+
<td>
|
212
|
+
|
213
|
+
<asp:Label ID="result5Label" runat="server" Text='<%# Bind("result5") %>' />
|
214
|
+
|
215
|
+
</td>
|
216
|
+
|
217
|
+
</tr>
|
218
|
+
|
219
|
+
<tr>
|
220
|
+
|
221
|
+
<td>
|
222
|
+
|
223
|
+
</td>
|
224
|
+
|
225
|
+
<td>
|
226
|
+
|
227
|
+
</td>
|
228
|
+
|
229
|
+
</tr>
|
230
|
+
|
231
|
+
</table>
|
232
|
+
|
233
|
+
<br />
|
234
|
+
|
235
|
+
<asp:Button ID="Button1" runat="server" CommandName="Edit" Text="編集" />
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
</ItemTemplate>
|
240
|
+
|
241
|
+
</asp:FormView>
|
242
|
+
|
243
|
+
</asp:Content>
|
56
244
|
|
57
245
|
```
|
58
246
|
|
59
|
-
当初は単純に編集画面で反映予定だったのですが、データの上書きではなく、新規登録フォームのドロップダウンリストへ反映させなければならなくなりました(新規登録フォームも編集モードのそれと同じです)。
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
回答と一緒に回答点数の値も同時に格納しなければならず、新規登録フォームは別ページに設定したほうがよいかと思いますので、その場合は単純なラベルコントロールの内容を反映するというよりは、別ページへのデータの受け渡しといった問題になるのでしょうか。
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<全体(フォームビューのものです)>
|
68
|
-
|
69
|
-
```ここに言語を入力
|
70
|
-
|
71
|
-
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID"
|
72
|
-
|
73
|
-
DataSourceID="SqlDataSource1" AllowPaging="True">
|
74
|
-
|
75
|
-
<EditItemTemplate>
|
76
|
-
|
77
|
-
<br />
|
78
|
-
|
79
|
-
<table cellpadding="0" cellspacing="0" class="style3">
|
80
|
-
|
81
|
-
<tr>
|
82
|
-
|
83
|
-
<td>
|
84
|
-
|
85
|
-
ID</td>
|
86
|
-
|
87
|
-
<td>
|
88
|
-
|
89
|
-
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
90
|
-
|
91
|
-
</td>
|
92
|
-
|
93
|
-
</tr>
|
94
|
-
|
95
|
-
<tr>
|
96
|
-
|
97
|
-
<td class="style4">
|
98
|
-
|
99
|
-
Result1</td>
|
100
|
-
|
101
|
-
<td class="style4">
|
102
|
-
|
103
|
-
<asp:DropDownList ID="DropDownList1" runat="server"
|
104
|
-
|
105
|
-
SelectedValue='<%# Bind("result1") %>'>
|
106
|
-
|
107
|
-
<asp:ListItem>はい</asp:ListItem>
|
108
|
-
|
109
|
-
<asp:ListItem>いいえ</asp:ListItem>
|
110
|
-
|
111
|
-
<asp:ListItem>未回答</asp:ListItem>
|
112
|
-
|
113
|
-
</asp:DropDownList>
|
114
|
-
|
115
|
-
</td>
|
116
|
-
|
117
|
-
</tr>
|
118
|
-
|
119
|
-
'ドロップダウンリスト5つ分
|
120
|
-
|
121
|
-
</table>
|
122
|
-
|
123
|
-
<br />
|
124
|
-
|
125
|
-
<asp:Button ID="Button2" runat="server" CommandName="Update" Text="登録" />
|
126
|
-
|
127
|
-
<asp:Button ID="Button3" runat="server" CommandName="Cancel" Text="キャンセル" />
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
</EditItemTemplate>
|
132
|
-
|
133
|
-
<ItemTemplate>
|
134
|
-
|
135
|
-
<br />
|
136
|
-
|
137
|
-
<table cellpadding="0" cellspacing="0" class="style3">
|
138
|
-
|
139
|
-
<tr>
|
140
|
-
|
141
|
-
<td>
|
142
|
-
|
143
|
-
ID</td>
|
144
|
-
|
145
|
-
<td>
|
146
|
-
|
147
|
-
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
148
|
-
|
149
|
-
</td>
|
150
|
-
|
151
|
-
</tr>
|
152
|
-
|
153
|
-
<tr>
|
154
|
-
|
155
|
-
<td>
|
156
|
-
|
157
|
-
Result1</td>
|
158
|
-
|
159
|
-
<td>
|
160
|
-
|
161
|
-
<asp:Label ID="result1Label" runat="server" Text='<%# Bind("result1") %>' />
|
162
|
-
|
163
|
-
</td>
|
164
|
-
|
165
|
-
</tr>
|
166
|
-
|
167
|
-
<tr>
|
168
|
-
|
169
|
-
<td>
|
170
|
-
|
171
|
-
Result2</td>
|
172
|
-
|
173
|
-
<td>
|
174
|
-
|
175
|
-
<asp:Label ID="result2Label" runat="server" Text='<%# Bind("result2") %>' />
|
176
|
-
|
177
|
-
</td>
|
178
|
-
|
179
|
-
</tr>
|
180
|
-
|
181
|
-
<tr>
|
182
|
-
|
183
|
-
<td>
|
184
|
-
|
185
|
-
Result3</td>
|
186
|
-
|
187
|
-
<td>
|
188
|
-
|
189
|
-
<asp:Label ID="result3Label" runat="server" Text='<%# Bind("result3") %>' />
|
190
|
-
|
191
|
-
</td>
|
192
|
-
|
193
|
-
</tr>
|
194
|
-
|
195
|
-
<tr>
|
196
|
-
|
197
|
-
<td>
|
198
|
-
|
199
|
-
Result4</td>
|
200
|
-
|
201
|
-
<td>
|
202
|
-
|
203
|
-
<asp:Label ID="result4Label" runat="server" Text='<%# Bind("result4") %>' />
|
204
|
-
|
205
|
-
</td>
|
206
|
-
|
207
|
-
</tr>
|
208
|
-
|
209
|
-
<tr>
|
210
|
-
|
211
|
-
<td>
|
212
|
-
|
213
|
-
Result5</td>
|
214
|
-
|
215
|
-
<td>
|
216
|
-
|
217
|
-
<asp:Label ID="result5Label" runat="server" Text='<%# Bind("result5") %>' />
|
218
|
-
|
219
|
-
</td>
|
220
|
-
|
221
|
-
</tr>
|
222
|
-
|
223
|
-
<tr>
|
224
|
-
|
225
|
-
<td>
|
226
|
-
|
227
|
-
</td>
|
228
|
-
|
229
|
-
<td>
|
230
|
-
|
231
|
-
</td>
|
232
|
-
|
233
|
-
</tr>
|
234
|
-
|
235
|
-
</table>
|
236
|
-
|
237
|
-
<br />
|
238
|
-
|
239
|
-
<asp:Button ID="Button1" runat="server" CommandName="Edit" Text="編集" />
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
</ItemTemplate>
|
244
|
-
|
245
|
-
</asp:FormView>
|
246
|
-
|
247
|
-
</asp:Content>
|
248
|
-
|
249
|
-
```
|
250
|
-
|
251
247
|
|
252
248
|
|
253
249
|
|
4
質問追加、タイトル、書式の変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
FormViewで表示するラベルコントロールの内容をDropDownListのデフォルト選択肢に反映させたいです。
|
1
|
+
FormViewで表示するラベルコントロールの内容をデータ新規登録用DropDownListのデフォルト選択肢に反映させたいです。
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
ASP.NET Webフォームアプリに関する質問です。
|
2
2
|
|
3
|
-
各質問に対する回答
|
3
|
+
各質問に対する回答機能を考えています。
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
|
25
|
+
表示用のラベルコントロールの内容を回答用ドロップダウンリストのデフォルトの選択肢に反映させることはできないのでしょうか。
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -46,9 +46,9 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
※
|
49
|
+
※9/9 追記
|
50
|
-
|
50
|
+
|
51
|
-
|
51
|
+
フォームビュー → 編集モードの際は以下の記述を付与することで一応成功しました。
|
52
52
|
|
53
53
|
```ここに言語を入力
|
54
54
|
|
@@ -56,9 +56,15 @@
|
|
56
56
|
|
57
57
|
```
|
58
58
|
|
59
|
-
|
59
|
+
当初は単純に編集画面で反映予定だったのですが、データの上書きではなく、新規登録フォームのドロップダウンリストへ反映させなければならなくなりました(新規登録フォームも編集モードのそれと同じです)。
|
60
|
+
|
61
|
+
|
62
|
+
|
60
|
-
|
63
|
+
回答と一緒に回答点数の値も同時に格納しなければならず、新規登録フォームは別ページに設定したほうがよいかと思いますので、その場合は単純なラベルコントロールの内容を反映するというよりは、別ページへのデータの受け渡しといった問題になるのでしょうか。
|
64
|
+
|
65
|
+
|
66
|
+
|
61
|
-
<全体>
|
67
|
+
<全体(フォームビューのものです)>
|
62
68
|
|
63
69
|
```ここに言語を入力
|
64
70
|
|
@@ -110,6 +116,54 @@
|
|
110
116
|
|
111
117
|
</tr>
|
112
118
|
|
119
|
+
'ドロップダウンリスト5つ分
|
120
|
+
|
121
|
+
</table>
|
122
|
+
|
123
|
+
<br />
|
124
|
+
|
125
|
+
<asp:Button ID="Button2" runat="server" CommandName="Update" Text="登録" />
|
126
|
+
|
127
|
+
<asp:Button ID="Button3" runat="server" CommandName="Cancel" Text="キャンセル" />
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
</EditItemTemplate>
|
132
|
+
|
133
|
+
<ItemTemplate>
|
134
|
+
|
135
|
+
<br />
|
136
|
+
|
137
|
+
<table cellpadding="0" cellspacing="0" class="style3">
|
138
|
+
|
139
|
+
<tr>
|
140
|
+
|
141
|
+
<td>
|
142
|
+
|
143
|
+
ID</td>
|
144
|
+
|
145
|
+
<td>
|
146
|
+
|
147
|
+
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
148
|
+
|
149
|
+
</td>
|
150
|
+
|
151
|
+
</tr>
|
152
|
+
|
153
|
+
<tr>
|
154
|
+
|
155
|
+
<td>
|
156
|
+
|
157
|
+
Result1</td>
|
158
|
+
|
159
|
+
<td>
|
160
|
+
|
161
|
+
<asp:Label ID="result1Label" runat="server" Text='<%# Bind("result1") %>' />
|
162
|
+
|
163
|
+
</td>
|
164
|
+
|
165
|
+
</tr>
|
166
|
+
|
113
167
|
<tr>
|
114
168
|
|
115
169
|
<td>
|
@@ -118,17 +172,7 @@
|
|
118
172
|
|
119
173
|
<td>
|
120
174
|
|
121
|
-
<asp:DropDownList ID="DropDownList2" runat="server"
|
122
|
-
|
123
|
-
|
175
|
+
<asp:Label ID="result2Label" runat="server" Text='<%# Bind("result2") %>' />
|
124
|
-
|
125
|
-
<asp:ListItem>はい</asp:ListItem>
|
126
|
-
|
127
|
-
<asp:ListItem>いいえ</asp:ListItem>
|
128
|
-
|
129
|
-
<asp:ListItem>未回答</asp:ListItem>
|
130
|
-
|
131
|
-
</asp:DropDownList>
|
132
176
|
|
133
177
|
</td>
|
134
178
|
|
@@ -142,17 +186,7 @@
|
|
142
186
|
|
143
187
|
<td>
|
144
188
|
|
145
|
-
<asp:DropDownList ID="DropDownList3" runat="server"
|
146
|
-
|
147
|
-
|
189
|
+
<asp:Label ID="result3Label" runat="server" Text='<%# Bind("result3") %>' />
|
148
|
-
|
149
|
-
<asp:ListItem>はい</asp:ListItem>
|
150
|
-
|
151
|
-
<asp:ListItem>いいえ</asp:ListItem>
|
152
|
-
|
153
|
-
<asp:ListItem>未回答</asp:ListItem>
|
154
|
-
|
155
|
-
</asp:DropDownList>
|
156
190
|
|
157
191
|
</td>
|
158
192
|
|
@@ -166,17 +200,7 @@
|
|
166
200
|
|
167
201
|
<td>
|
168
202
|
|
169
|
-
<asp:DropDownList ID="DropDownList4" runat="server"
|
170
|
-
|
171
|
-
|
203
|
+
<asp:Label ID="result4Label" runat="server" Text='<%# Bind("result4") %>' />
|
172
|
-
|
173
|
-
<asp:ListItem>はい</asp:ListItem>
|
174
|
-
|
175
|
-
<asp:ListItem>いいえ</asp:ListItem>
|
176
|
-
|
177
|
-
<asp:ListItem>未回答</asp:ListItem>
|
178
|
-
|
179
|
-
</asp:DropDownList>
|
180
204
|
|
181
205
|
</td>
|
182
206
|
|
@@ -190,17 +214,7 @@
|
|
190
214
|
|
191
215
|
<td>
|
192
216
|
|
193
|
-
<asp:DropDownList ID="DropDownList5" runat="server"
|
194
|
-
|
195
|
-
|
217
|
+
<asp:Label ID="result5Label" runat="server" Text='<%# Bind("result5") %>' />
|
196
|
-
|
197
|
-
<asp:ListItem>はい</asp:ListItem>
|
198
|
-
|
199
|
-
<asp:ListItem>いいえ</asp:ListItem>
|
200
|
-
|
201
|
-
<asp:ListItem>未回答</asp:ListItem>
|
202
|
-
|
203
|
-
</asp:DropDownList>
|
204
218
|
|
205
219
|
</td>
|
206
220
|
|
@@ -222,124 +236,10 @@
|
|
222
236
|
|
223
237
|
<br />
|
224
238
|
|
225
|
-
<asp:Button ID="Button
|
239
|
+
<asp:Button ID="Button1" runat="server" CommandName="Edit" Text="編集" />
|
226
|
-
|
227
|
-
<asp:Button ID="Button3" runat="server" CommandName="Cancel" Text="キャンセル" />
|
228
240
|
|
229
241
|
|
230
242
|
|
231
|
-
</EditItemTemplate>
|
232
|
-
|
233
|
-
<ItemTemplate>
|
234
|
-
|
235
|
-
<br />
|
236
|
-
|
237
|
-
<table cellpadding="0" cellspacing="0" class="style3">
|
238
|
-
|
239
|
-
<tr>
|
240
|
-
|
241
|
-
<td>
|
242
|
-
|
243
|
-
ID</td>
|
244
|
-
|
245
|
-
<td>
|
246
|
-
|
247
|
-
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
248
|
-
|
249
|
-
</td>
|
250
|
-
|
251
|
-
</tr>
|
252
|
-
|
253
|
-
<tr>
|
254
|
-
|
255
|
-
<td>
|
256
|
-
|
257
|
-
Result1</td>
|
258
|
-
|
259
|
-
<td>
|
260
|
-
|
261
|
-
<asp:Label ID="result1Label" runat="server" Text='<%# Bind("result1") %>' />
|
262
|
-
|
263
|
-
</td>
|
264
|
-
|
265
|
-
</tr>
|
266
|
-
|
267
|
-
<tr>
|
268
|
-
|
269
|
-
<td>
|
270
|
-
|
271
|
-
Result2</td>
|
272
|
-
|
273
|
-
<td>
|
274
|
-
|
275
|
-
<asp:Label ID="result2Label" runat="server" Text='<%# Bind("result2") %>' />
|
276
|
-
|
277
|
-
</td>
|
278
|
-
|
279
|
-
</tr>
|
280
|
-
|
281
|
-
<tr>
|
282
|
-
|
283
|
-
<td>
|
284
|
-
|
285
|
-
Result3</td>
|
286
|
-
|
287
|
-
<td>
|
288
|
-
|
289
|
-
<asp:Label ID="result3Label" runat="server" Text='<%# Bind("result3") %>' />
|
290
|
-
|
291
|
-
</td>
|
292
|
-
|
293
|
-
</tr>
|
294
|
-
|
295
|
-
<tr>
|
296
|
-
|
297
|
-
<td>
|
298
|
-
|
299
|
-
Result4</td>
|
300
|
-
|
301
|
-
<td>
|
302
|
-
|
303
|
-
<asp:Label ID="result4Label" runat="server" Text='<%# Bind("result4") %>' />
|
304
|
-
|
305
|
-
</td>
|
306
|
-
|
307
|
-
</tr>
|
308
|
-
|
309
|
-
<tr>
|
310
|
-
|
311
|
-
<td>
|
312
|
-
|
313
|
-
Result5</td>
|
314
|
-
|
315
|
-
<td>
|
316
|
-
|
317
|
-
<asp:Label ID="result5Label" runat="server" Text='<%# Bind("result5") %>' />
|
318
|
-
|
319
|
-
</td>
|
320
|
-
|
321
|
-
</tr>
|
322
|
-
|
323
|
-
<tr>
|
324
|
-
|
325
|
-
<td>
|
326
|
-
|
327
|
-
</td>
|
328
|
-
|
329
|
-
<td>
|
330
|
-
|
331
|
-
</td>
|
332
|
-
|
333
|
-
</tr>
|
334
|
-
|
335
|
-
</table>
|
336
|
-
|
337
|
-
<br />
|
338
|
-
|
339
|
-
<asp:Button ID="Button1" runat="server" CommandName="Edit" Text="編集" />
|
340
|
-
|
341
|
-
|
342
|
-
|
343
243
|
</ItemTemplate>
|
344
244
|
|
345
245
|
</asp:FormView>
|
3
ソースコードの記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,6 +46,310 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
+
※ソースコードを追加で記載しておきます。
|
50
|
+
|
51
|
+
FormViewでの表示内容を反映させることについては以下の部分の記述方法で一応成功しました。
|
52
|
+
|
53
|
+
```ここに言語を入力
|
54
|
+
|
55
|
+
SelectedValue='<%# Bind("result1") %>'
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<全体>
|
62
|
+
|
63
|
+
```ここに言語を入力
|
64
|
+
|
65
|
+
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID"
|
66
|
+
|
67
|
+
DataSourceID="SqlDataSource1" AllowPaging="True">
|
68
|
+
|
69
|
+
<EditItemTemplate>
|
70
|
+
|
71
|
+
<br />
|
72
|
+
|
73
|
+
<table cellpadding="0" cellspacing="0" class="style3">
|
74
|
+
|
75
|
+
<tr>
|
76
|
+
|
77
|
+
<td>
|
78
|
+
|
79
|
+
ID</td>
|
80
|
+
|
81
|
+
<td>
|
82
|
+
|
83
|
+
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
84
|
+
|
85
|
+
</td>
|
86
|
+
|
87
|
+
</tr>
|
88
|
+
|
89
|
+
<tr>
|
90
|
+
|
91
|
+
<td class="style4">
|
92
|
+
|
93
|
+
Result1</td>
|
94
|
+
|
95
|
+
<td class="style4">
|
96
|
+
|
97
|
+
<asp:DropDownList ID="DropDownList1" runat="server"
|
98
|
+
|
99
|
+
SelectedValue='<%# Bind("result1") %>'>
|
100
|
+
|
101
|
+
<asp:ListItem>はい</asp:ListItem>
|
102
|
+
|
103
|
+
<asp:ListItem>いいえ</asp:ListItem>
|
104
|
+
|
105
|
+
<asp:ListItem>未回答</asp:ListItem>
|
106
|
+
|
107
|
+
</asp:DropDownList>
|
108
|
+
|
109
|
+
</td>
|
110
|
+
|
111
|
+
</tr>
|
112
|
+
|
113
|
+
<tr>
|
114
|
+
|
115
|
+
<td>
|
116
|
+
|
117
|
+
Result2</td>
|
118
|
+
|
119
|
+
<td>
|
120
|
+
|
121
|
+
<asp:DropDownList ID="DropDownList2" runat="server"
|
122
|
+
|
123
|
+
SelectedValue='<%# Bind("result2") %>'>
|
124
|
+
|
125
|
+
<asp:ListItem>はい</asp:ListItem>
|
126
|
+
|
127
|
+
<asp:ListItem>いいえ</asp:ListItem>
|
128
|
+
|
129
|
+
<asp:ListItem>未回答</asp:ListItem>
|
130
|
+
|
131
|
+
</asp:DropDownList>
|
132
|
+
|
133
|
+
</td>
|
134
|
+
|
135
|
+
</tr>
|
136
|
+
|
137
|
+
<tr>
|
138
|
+
|
139
|
+
<td>
|
140
|
+
|
141
|
+
Result3</td>
|
142
|
+
|
143
|
+
<td>
|
144
|
+
|
145
|
+
<asp:DropDownList ID="DropDownList3" runat="server"
|
146
|
+
|
147
|
+
SelectedValue='<%# Bind("result3") %>'>
|
148
|
+
|
149
|
+
<asp:ListItem>はい</asp:ListItem>
|
150
|
+
|
151
|
+
<asp:ListItem>いいえ</asp:ListItem>
|
152
|
+
|
153
|
+
<asp:ListItem>未回答</asp:ListItem>
|
154
|
+
|
155
|
+
</asp:DropDownList>
|
156
|
+
|
157
|
+
</td>
|
158
|
+
|
159
|
+
</tr>
|
160
|
+
|
161
|
+
<tr>
|
162
|
+
|
163
|
+
<td>
|
164
|
+
|
165
|
+
Result4</td>
|
166
|
+
|
167
|
+
<td>
|
168
|
+
|
169
|
+
<asp:DropDownList ID="DropDownList4" runat="server"
|
170
|
+
|
171
|
+
SelectedValue='<%# Bind("result4") %>'>
|
172
|
+
|
173
|
+
<asp:ListItem>はい</asp:ListItem>
|
174
|
+
|
175
|
+
<asp:ListItem>いいえ</asp:ListItem>
|
176
|
+
|
177
|
+
<asp:ListItem>未回答</asp:ListItem>
|
178
|
+
|
179
|
+
</asp:DropDownList>
|
180
|
+
|
181
|
+
</td>
|
182
|
+
|
183
|
+
</tr>
|
184
|
+
|
185
|
+
<tr>
|
186
|
+
|
187
|
+
<td>
|
188
|
+
|
189
|
+
Result5</td>
|
190
|
+
|
191
|
+
<td>
|
192
|
+
|
193
|
+
<asp:DropDownList ID="DropDownList5" runat="server"
|
194
|
+
|
195
|
+
SelectedValue='<%# Bind("result5") %>'>
|
196
|
+
|
197
|
+
<asp:ListItem>はい</asp:ListItem>
|
198
|
+
|
199
|
+
<asp:ListItem>いいえ</asp:ListItem>
|
200
|
+
|
201
|
+
<asp:ListItem>未回答</asp:ListItem>
|
202
|
+
|
203
|
+
</asp:DropDownList>
|
204
|
+
|
205
|
+
</td>
|
206
|
+
|
207
|
+
</tr>
|
208
|
+
|
209
|
+
<tr>
|
210
|
+
|
211
|
+
<td>
|
212
|
+
|
213
|
+
</td>
|
214
|
+
|
215
|
+
<td>
|
216
|
+
|
217
|
+
</td>
|
218
|
+
|
219
|
+
</tr>
|
220
|
+
|
221
|
+
</table>
|
222
|
+
|
223
|
+
<br />
|
224
|
+
|
225
|
+
<asp:Button ID="Button2" runat="server" CommandName="Update" Text="登録" />
|
226
|
+
|
227
|
+
<asp:Button ID="Button3" runat="server" CommandName="Cancel" Text="キャンセル" />
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</EditItemTemplate>
|
232
|
+
|
233
|
+
<ItemTemplate>
|
234
|
+
|
235
|
+
<br />
|
236
|
+
|
237
|
+
<table cellpadding="0" cellspacing="0" class="style3">
|
238
|
+
|
239
|
+
<tr>
|
240
|
+
|
241
|
+
<td>
|
242
|
+
|
243
|
+
ID</td>
|
244
|
+
|
245
|
+
<td>
|
246
|
+
|
247
|
+
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
|
248
|
+
|
249
|
+
</td>
|
250
|
+
|
251
|
+
</tr>
|
252
|
+
|
253
|
+
<tr>
|
254
|
+
|
255
|
+
<td>
|
256
|
+
|
257
|
+
Result1</td>
|
258
|
+
|
259
|
+
<td>
|
260
|
+
|
261
|
+
<asp:Label ID="result1Label" runat="server" Text='<%# Bind("result1") %>' />
|
262
|
+
|
263
|
+
</td>
|
264
|
+
|
265
|
+
</tr>
|
266
|
+
|
267
|
+
<tr>
|
268
|
+
|
269
|
+
<td>
|
270
|
+
|
271
|
+
Result2</td>
|
272
|
+
|
273
|
+
<td>
|
274
|
+
|
275
|
+
<asp:Label ID="result2Label" runat="server" Text='<%# Bind("result2") %>' />
|
276
|
+
|
277
|
+
</td>
|
278
|
+
|
279
|
+
</tr>
|
280
|
+
|
281
|
+
<tr>
|
282
|
+
|
283
|
+
<td>
|
284
|
+
|
285
|
+
Result3</td>
|
286
|
+
|
287
|
+
<td>
|
288
|
+
|
289
|
+
<asp:Label ID="result3Label" runat="server" Text='<%# Bind("result3") %>' />
|
290
|
+
|
291
|
+
</td>
|
292
|
+
|
293
|
+
</tr>
|
294
|
+
|
295
|
+
<tr>
|
296
|
+
|
297
|
+
<td>
|
298
|
+
|
299
|
+
Result4</td>
|
300
|
+
|
301
|
+
<td>
|
302
|
+
|
303
|
+
<asp:Label ID="result4Label" runat="server" Text='<%# Bind("result4") %>' />
|
304
|
+
|
305
|
+
</td>
|
306
|
+
|
307
|
+
</tr>
|
308
|
+
|
309
|
+
<tr>
|
310
|
+
|
311
|
+
<td>
|
312
|
+
|
313
|
+
Result5</td>
|
314
|
+
|
315
|
+
<td>
|
316
|
+
|
317
|
+
<asp:Label ID="result5Label" runat="server" Text='<%# Bind("result5") %>' />
|
318
|
+
|
319
|
+
</td>
|
320
|
+
|
321
|
+
</tr>
|
322
|
+
|
323
|
+
<tr>
|
324
|
+
|
325
|
+
<td>
|
326
|
+
|
327
|
+
</td>
|
328
|
+
|
329
|
+
<td>
|
330
|
+
|
331
|
+
</td>
|
332
|
+
|
333
|
+
</tr>
|
334
|
+
|
335
|
+
</table>
|
336
|
+
|
337
|
+
<br />
|
338
|
+
|
339
|
+
<asp:Button ID="Button1" runat="server" CommandName="Edit" Text="編集" />
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
</ItemTemplate>
|
344
|
+
|
345
|
+
</asp:FormView>
|
346
|
+
|
347
|
+
</asp:Content>
|
348
|
+
|
349
|
+
```
|
350
|
+
|
351
|
+
|
352
|
+
|
49
353
|
|
50
354
|
|
51
355
|
わかりにくい質問ですが、反応いただけるとありがたいです。
|
2
タイトル、質問書式の改編
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
DropDownListのデフォルト選択肢
|
1
|
+
FormViewで表示するラベルコントロールの内容をDropDownListのデフォルト選択肢に反映させたいです。
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
ASP.NET Webフォームアプリに関する質問です。
|
2
2
|
|
3
|
-
|
3
|
+
各質問に対する回答を編集できるミニ機能を考えています。
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -8,43 +8,41 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
言葉にしにくいのですが、ドロップダウンリストの選択肢をデータベースの格納内容にしたい(単純にデータバインド)というわけではありません。
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
以下のようなテーブル(
|
11
|
+
以下のような内容のテーブル(過去の回答を格納)をFormViewコントロールを用いて表示します。
|
18
|
-
|
19
|
-
|
20
12
|
|
21
13
|

|
22
14
|
|
23
|
-
|
15
|
+
ID : int型、result1 ~ result5 : string型
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
編集モード(FormView1 -EditItemTemplate)にするとそれぞれの列がドロップダウンリストに置き換わるとした際、
|
28
|
-
|
29
|
-
(ドロップダウンリストの選択肢はいずれも以下の3つで固定)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-

|
34
|
-
|
35
|
-
※ Text :「はい」 value : 1
|
36
|
-
|
37
|
-
Text :「いいえ」 value : 0
|
38
|
-
|
39
|
-
Text :「未回答」 value : NULL
|
40
16
|
|
41
17
|
|
42
18
|
|
43
19
|
|
44
20
|
|
45
|
-
|
21
|
+

|
46
22
|
|
23
|
+
|
24
|
+
|
25
|
+
「編集」ボタンを押すといわゆる「FormView1 -EditItemTemplate」の状態に移行して編集ができるようになりますが、回答はドロップダウンリストを用いて行うとした際、表示用のラベルコントロールの内容をドロップダウンリストのデフォルトの選択肢に反映させることはできないのでしょうか。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+

|
30
|
+
|
31
|
+
※わかりやすいようにFormView表示用のラベルコントロールもそのまま残しています。
|
32
|
+
|
33
|
+
|
34
|
+
|
47
|
-
|
35
|
+
たとえば、FormViewでの表示が「はい」なら、ドロップダウンリストでデフォルト選択されているのも「はい」、といった具合です。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
<ドロップダウンリストの選択肢>
|
40
|
+
|
41
|
+
※ Text :「はい」 value : はい
|
42
|
+
|
43
|
+
Text :「いいえ」 value : いいえ
|
44
|
+
|
45
|
+
Text :「未回答」 value : 未回答
|
48
46
|
|
49
47
|
|
50
48
|
|
1
実装環境追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
ここのところたびたびお世話になっております。
|
2
|
+
|
3
|
+
ASP.NET Webフォームアプリに関する質問です。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
※OSはWindows7、.NET Framework4、Visual Stdio 2010、SQLserver2012、IE11を利用しています。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
2
12
|
|
3
13
|
言葉にしにくいのですが、ドロップダウンリストの選択肢をデータベースの格納内容にしたい(単純にデータバインド)というわけではありません。
|
4
14
|
|
@@ -10,7 +20,7 @@
|
|
10
20
|
|
11
21
|

|
12
22
|
|
13
|
-
|
23
|
+
スキーマは、ID : int型、result1 ~ result5 : string型
|
14
24
|
|
15
25
|
|
16
26
|
|