質問編集履歴
1
コードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -17,6 +17,90 @@
|
|
17
17
|
|
18
18
|
よろしくお願いいたします。
|
19
19
|
|
20
|
+
### やったこと
|
21
|
+
|
22
|
+
以下コードでやってみました。
|
23
|
+
ページの初期表示は問題なくできました。取得のボタンを押した際にloadingからhello worldの文字も表示されますが、実際にやりたいこととしてはこれを全行に対して並列的に行いたいです(ページ読込後に全行のボタンをおすようにjsでクリックさせるつもりでした)。
|
24
|
+
ただupdatepanelでは部分的に変わっているのは表示上のみで、実際にはpostbackが毎回走っているはずなので、ボタンイベントが完了しないまま連続的に1,2,3行目とおしても最後におしたボタンの行のみの更新となってしまいます。
|
25
|
+
|
26
|
+
WebForm1.aspx
|
27
|
+
```html
|
28
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
29
|
+
<head runat="server">
|
30
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
31
|
+
<title></title>
|
32
|
+
|
33
|
+
</head>
|
34
|
+
<body>
|
35
|
+
<form id="form1" runat="server">
|
36
|
+
<div>
|
37
|
+
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
|
38
|
+
<asp:ListView ID="ListView1" runat="server">
|
39
|
+
<LayoutTemplate>
|
40
|
+
<table>
|
41
|
+
<tr>
|
42
|
+
<th>ID</th>
|
43
|
+
<th></th>
|
44
|
+
</tr>
|
45
|
+
<tr id="itemPlaceHolder" runat="server"></tr>
|
46
|
+
</table>
|
47
|
+
</LayoutTemplate>
|
48
|
+
<ItemTemplate>
|
49
|
+
<tr>
|
50
|
+
<td><%# Eval("ID") %></td>
|
51
|
+
<td>
|
52
|
+
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
|
53
|
+
<ProgressTemplate>
|
54
|
+
Loading..
|
55
|
+
</ProgressTemplate>
|
56
|
+
</asp:UpdateProgress>
|
57
|
+
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
|
58
|
+
<ContentTemplate>
|
59
|
+
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
|
60
|
+
<asp:Button ID="Button1" runat="server" Text="取得" OnClick="Button1_Click" />
|
61
|
+
</ContentTemplate>
|
62
|
+
</asp:UpdatePanel>
|
63
|
+
</td>
|
64
|
+
</tr>
|
65
|
+
</ItemTemplate>
|
66
|
+
</asp:ListView>
|
67
|
+
</div>
|
68
|
+
</form>
|
69
|
+
</body>
|
70
|
+
</html>
|
71
|
+
```
|
72
|
+
|
73
|
+
WebForm1.aspx.vb
|
74
|
+
```vb
|
75
|
+
Public Class WebForm1
|
76
|
+
Inherits System.Web.UI.Page
|
77
|
+
|
78
|
+
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
|
79
|
+
If Not IsPostBack Then
|
80
|
+
ListView1.DataSource = GetDataSource()
|
81
|
+
ListView1.DataBind()
|
82
|
+
End If
|
83
|
+
End Sub
|
84
|
+
|
85
|
+
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
|
86
|
+
'ここで付加情報をDBから取得する想定
|
87
|
+
System.Threading.Thread.Sleep(5000)
|
88
|
+
Dim str As String = "Hello World"
|
89
|
+
Dim i As Integer = CType(sender, Button).CommandArgument
|
90
|
+
CType(ListView1.Items(i).FindControl("Label1"), Label).Text = str
|
91
|
+
End Sub
|
92
|
+
|
93
|
+
Private Sub ListView1_DataBound(sender As Object, e As EventArgs) Handles ListView1.DataBound
|
94
|
+
For i As Integer = 0 To ListView1.Items.Count - 1
|
95
|
+
CType(ListView1.Items(i).FindControl("Button1"), Button).CommandArgument = i
|
96
|
+
Next
|
97
|
+
End Sub
|
98
|
+
|
99
|
+
Function GetDataSource() As DataTable
|
100
|
+
'基本情報の取得
|
101
|
+
End Function
|
102
|
+
End Class
|
103
|
+
```
|
20
104
|
### 補足情報(FW/ツールのバージョンなど)
|
21
105
|
|
22
106
|
.net framework 4.8
|