回答編集履歴
2
追記
test
CHANGED
@@ -139,3 +139,297 @@
|
|
139
139
|
</html>
|
140
140
|
|
141
141
|
```
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
**【追記】**
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
質問への 2018/05/31 09:12 の私のコメントで「全体的なやりたいことのシナリオ・ストーリーを書いてもらえませんか? それに合わせて徐々に実装しながら検証してみますので」と書きましたが、それを以下に書いておきます。
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
やりたいことは以下の通りと理解。
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
(1) Panel 内に UpdatePanel、その中に GridView を実装。
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
(2) Panel の外に TextBox と Button を配置。
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
(3) ModalPopupExtender を配置し、PopupControlID を上記 (1) の Panel に、TargetControlID を上記(2)の Button に設定。
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
(4) Button クリックで Panel(その中の GridView も)表示。
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
(5) GridView の行選択で Panel を非表示にして TextBox に選択した行のデータを表示。
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
上記やりたいことの最低限の実装ですが、以下のコードで期待通り Firefox 60.0.1 でも動きます。
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
質問者さんの環境で動かないとすると、質問者さんの環境固有の問題だと思われます。
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
動くとすると、これに加えて質問者さんがいろいろ実装したコードの影響だと思います。何か違うのか、何の影響なのか質問者さんの方で良く調べてください。
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
**.aspx.cs**
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
```
|
196
|
+
|
197
|
+
using System;
|
198
|
+
|
199
|
+
using System.Collections.Generic;
|
200
|
+
|
201
|
+
using System.Linq;
|
202
|
+
|
203
|
+
using System.Web;
|
204
|
+
|
205
|
+
using System.Web.UI;
|
206
|
+
|
207
|
+
using System.Web.UI.WebControls;
|
208
|
+
|
209
|
+
using System.Data;
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
namespace WebFormsAppNET4
|
214
|
+
|
215
|
+
{
|
216
|
+
|
217
|
+
public partial class _default : System.Web.UI.Page
|
218
|
+
|
219
|
+
{
|
220
|
+
|
221
|
+
protected void Page_Load(object sender, EventArgs e)
|
222
|
+
|
223
|
+
{
|
224
|
+
|
225
|
+
if (!IsPostBack)
|
226
|
+
|
227
|
+
{
|
228
|
+
|
229
|
+
DataTable dt = new DataTable();
|
230
|
+
|
231
|
+
dt.Columns.Add("Test");
|
232
|
+
|
233
|
+
dt.Rows.Add(new object[] { "1" });
|
234
|
+
|
235
|
+
dt.Rows.Add(new object[] { "2" });
|
236
|
+
|
237
|
+
dt.Rows.Add(new object[] { "3" });
|
238
|
+
|
239
|
+
dt.Rows.Add(new object[] { "4" });
|
240
|
+
|
241
|
+
GridView1.DataSource = dt;
|
242
|
+
|
243
|
+
GridView1.DataBind();
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
|
252
|
+
|
253
|
+
{
|
254
|
+
|
255
|
+
if (ScriptManager.GetCurrent(this).IsInAsyncPostBack)
|
256
|
+
|
257
|
+
{
|
258
|
+
|
259
|
+
ScriptManager.GetCurrent(this).RegisterDataItem(GridView1,
|
260
|
+
|
261
|
+
GridView1.SelectedRow.Cells[1].Text);
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
ModalPopupExtender1.Hide();
|
266
|
+
|
267
|
+
}
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
```
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
**.aspx**
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
```
|
282
|
+
|
283
|
+
<%@ Page Language="C#" AutoEventWireup="true"
|
284
|
+
|
285
|
+
CodeBehind="default.aspx.cs" Inherits="WebFormsAppNET4._default" %>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<%@ Register Assembly="AjaxControlToolkit"
|
290
|
+
|
291
|
+
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
<!DOCTYPE html>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
300
|
+
|
301
|
+
<head runat="server">
|
302
|
+
|
303
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
304
|
+
|
305
|
+
<title></title>
|
306
|
+
|
307
|
+
<script type="text/javascript">
|
308
|
+
|
309
|
+
//<![CDATA[
|
310
|
+
|
311
|
+
var manager;
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
function pageLoad(sender, args) {
|
316
|
+
|
317
|
+
if (args.get_isPartialLoad() === false) {
|
318
|
+
|
319
|
+
manager = Sys.WebForms.PageRequestManager.getInstance();
|
320
|
+
|
321
|
+
manager.add_pageLoaded(pageLoaded);
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
function pageLoaded(sender, args) {
|
330
|
+
|
331
|
+
if (manager.get_isInAsyncPostBack()) {
|
332
|
+
|
333
|
+
var selectedIndex = args.get_dataItems()["GridView1"];
|
334
|
+
|
335
|
+
document.getElementById("TextBox1").value = selectedIndex;
|
336
|
+
|
337
|
+
}
|
338
|
+
|
339
|
+
}
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
//]]>
|
344
|
+
|
345
|
+
</script>
|
346
|
+
|
347
|
+
<style type="text/css">
|
348
|
+
|
349
|
+
/*Modal Popup*/
|
350
|
+
|
351
|
+
.modalBackground {
|
352
|
+
|
353
|
+
background-color: Gray;
|
354
|
+
|
355
|
+
filter: alpha(opacity=70);
|
356
|
+
|
357
|
+
opacity: 0.7;
|
358
|
+
|
359
|
+
}
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
.popuppanel {
|
364
|
+
|
365
|
+
background-color: #ffffff;
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
</style>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
</head>
|
374
|
+
|
375
|
+
<body>
|
376
|
+
|
377
|
+
<form id="form1" runat="server">
|
378
|
+
|
379
|
+
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
|
384
|
+
|
385
|
+
<asp:Button ID="Button1" runat="server" Text="Button" />
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
<asp:Panel ID="Panel1" runat="server" CssClass="popuppanel">
|
390
|
+
|
391
|
+
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
|
392
|
+
|
393
|
+
<ContentTemplate>
|
394
|
+
|
395
|
+
<asp:GridView ID="GridView1" runat="server"
|
396
|
+
|
397
|
+
AutoGenerateColumns="False"
|
398
|
+
|
399
|
+
AutoGenerateSelectButton="True"
|
400
|
+
|
401
|
+
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
|
402
|
+
|
403
|
+
<Columns>
|
404
|
+
|
405
|
+
<asp:BoundField DataField="Test" HeaderText="テスト" />
|
406
|
+
|
407
|
+
</Columns>
|
408
|
+
|
409
|
+
</asp:GridView>
|
410
|
+
|
411
|
+
</ContentTemplate>
|
412
|
+
|
413
|
+
</asp:UpdatePanel>
|
414
|
+
|
415
|
+
</asp:Panel>
|
416
|
+
|
417
|
+
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1"
|
418
|
+
|
419
|
+
runat="server"
|
420
|
+
|
421
|
+
PopupControlID="Panel1"
|
422
|
+
|
423
|
+
TargetControlID="Button1"
|
424
|
+
|
425
|
+
BackgroundCssClass="modalBackground">
|
426
|
+
|
427
|
+
</ajaxToolkit:ModalPopupExtender>
|
428
|
+
|
429
|
+
</form>
|
430
|
+
|
431
|
+
</body>
|
432
|
+
|
433
|
+
</html>
|
434
|
+
|
435
|
+
```
|
1
ていせい
test
CHANGED
@@ -86,7 +86,7 @@
|
|
86
86
|
|
87
87
|
manager = Sys.WebForms.PageRequestManager.getInstance();
|
88
88
|
|
89
|
-
manager.add_pageLoaded(pageLoaded)
|
89
|
+
manager.add_pageLoaded(pageLoaded);
|
90
90
|
|
91
91
|
}
|
92
92
|
|