質問編集履歴
4
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,194 +7,6 @@
|
|
7
7
|
下記のListViewに投稿時刻の降順でソートしたいのですがどのように記述したらよろしいでしょうか。
|
8
8
|
|
9
9
|
|
10
|
-
|
11
|
-
```
|
12
|
-
|
13
|
-
<asp:ListView ID="ListView1" runat="server" DataSourceID="xxx" DataKeyNames="name" InsertItemPosition="LastItem">
|
14
|
-
|
15
|
-
<AlternatingItemTemplate>
|
16
|
-
|
17
|
-
<li style="">
|
18
|
-
|
19
|
-
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("name") %>' />
|
20
|
-
|
21
|
-
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
|
22
|
-
|
23
|
-
<asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' />
|
24
|
-
|
25
|
-
<asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
|
26
|
-
|
27
|
-
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編集" />
|
28
|
-
|
29
|
-
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="削除" />
|
30
|
-
|
31
|
-
</li>
|
32
|
-
|
33
|
-
</AlternatingItemTemplate>
|
34
|
-
|
35
|
-
<EditItemTemplate>
|
36
|
-
|
37
|
-
<li style="">
|
38
|
-
|
39
|
-
<asp:Label ID="IdLabel1" runat="server" Text='<%# Eval("name") %>' />
|
40
|
-
|
41
|
-
<asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
|
42
|
-
|
43
|
-
<asp:TextBox ID="ContentTextBox" runat="server" Text='<%# Bind("Content") %>' />
|
44
|
-
|
45
|
-
<asp:TextBox ID="TimeTextBox" runat="server" Text='<%# Bind("TIme") %>' />
|
46
|
-
|
47
|
-
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
|
48
|
-
|
49
|
-
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="キャンセル" />
|
50
|
-
|
51
|
-
</li>
|
52
|
-
|
53
|
-
</EditItemTemplate>
|
54
|
-
|
55
|
-
<EmptyDataTemplate>
|
56
|
-
|
57
|
-
データは返されませんでした。
|
58
|
-
|
59
|
-
</EmptyDataTemplate>
|
60
|
-
|
61
|
-
<InsertItemTemplate>
|
62
|
-
|
63
|
-
<li style="">
|
64
|
-
|
65
|
-
<asp:TextBox ID="IdTextBox" runat="server" class="textsize" Text='<%# Bind("name") %>' />
|
66
|
-
|
67
|
-
<asp:TextBox ID="TitleTextBox" runat="server" class="textsize" Text='<%# Bind("Title") %>'
|
68
|
-
|
69
|
-
<asp:TextBox ID="ContentTextBox" runat="server" class="textsize" Text='<%# Bind("Content") %>' />
|
70
|
-
|
71
|
-
<asp:TextBox ID="TimeTextBox" runat="server" class="textsize" Text='<%# Bind("Time") %>' />
|
72
|
-
|
73
|
-
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="投稿" />
|
74
|
-
|
75
|
-
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="クリア" />
|
76
|
-
|
77
|
-
</li>
|
78
|
-
|
79
|
-
</InsertItemTemplate>
|
80
|
-
|
81
|
-
<ItemSeparatorTemplate>
|
82
|
-
|
83
|
-
</ItemSeparatorTemplate>
|
84
|
-
|
85
|
-
<ItemTemplate>
|
86
|
-
|
87
|
-
<li style="">
|
88
|
-
|
89
|
-
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("name") %>' />
|
90
|
-
|
91
|
-
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
|
92
|
-
|
93
|
-
<asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' />
|
94
|
-
|
95
|
-
<asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
|
96
|
-
|
97
|
-
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編集" />
|
98
|
-
|
99
|
-
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="削除" />
|
100
|
-
|
101
|
-
</li>
|
102
|
-
|
103
|
-
</ItemTemplate>
|
104
|
-
|
105
|
-
<LayoutTemplate>
|
106
|
-
|
107
|
-
<ul id="itemPlaceholderContainer" runat="server" style="">
|
108
|
-
|
109
|
-
<li runat="server" id="itemPlaceholder" />
|
110
|
-
|
111
|
-
</ul>
|
112
|
-
|
113
|
-
<div style="">
|
114
|
-
|
115
|
-
<asp:DataPager ID="DataPager1" runat="server">
|
116
|
-
|
117
|
-
<Fields>
|
118
|
-
|
119
|
-
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
|
120
|
-
|
121
|
-
<asp:NumericPagerField />
|
122
|
-
|
123
|
-
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
|
124
|
-
|
125
|
-
</Fields>
|
126
|
-
|
127
|
-
</asp:DataPager>
|
128
|
-
|
129
|
-
</div>
|
130
|
-
|
131
|
-
</LayoutTemplate>
|
132
|
-
|
133
|
-
<SelectedItemTemplate>
|
134
|
-
|
135
|
-
<li style="">
|
136
|
-
|
137
|
-
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("name") %>' />
|
138
|
-
|
139
|
-
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
|
140
|
-
|
141
|
-
<asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' />
|
142
|
-
|
143
|
-
<asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
|
144
|
-
|
145
|
-
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編集" />
|
146
|
-
|
147
|
-
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="削除" />
|
148
|
-
|
149
|
-
</li>
|
150
|
-
|
151
|
-
</SelectedItemTemplate>
|
152
|
-
|
153
|
-
</asp:ListView>
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
<asp:SqlDataSource ID="xxx" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SELECT * FROM [xxx]" DeleteCommand="DELETE FROM [xxx] WHERE [name] = @name" InsertCommand="INSERT INTO [xxx] ([name], [Title], [Content],[Time]) VALUES (@name, @Title, @Content)" UpdateCommand="UPDATE [xxx] SET [Title] = @Title, [Content] = @Content,[Time] = @Time WHERE [name] = @name">
|
160
|
-
|
161
|
-
<DeleteParameters>
|
162
|
-
|
163
|
-
<asp:Parameter Name="name" Type="String" />
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
</DeleteParameters>
|
168
|
-
|
169
|
-
<InsertParameters>
|
170
|
-
|
171
|
-
<asp:Parameter Name="name" Type="String" />
|
172
|
-
|
173
|
-
<asp:Parameter Name="Title" Type="String" />
|
174
|
-
|
175
|
-
<asp:Parameter Name="Content" Type="String" />
|
176
|
-
|
177
|
-
<asp:Parameter Name="Time" Type="String" />
|
178
|
-
|
179
|
-
</InsertParameters>
|
180
|
-
|
181
|
-
<UpdateParameters>
|
182
|
-
|
183
|
-
<asp:Parameter Name="Title" Type="String" />
|
184
|
-
|
185
|
-
<asp:Parameter Name="Content" Type="String" />
|
186
|
-
|
187
|
-
<asp:Parameter Name="name" Type="String" />
|
188
|
-
|
189
|
-
<asp:Parameter Name="Time" Type="String" />
|
190
|
-
|
191
|
-
</UpdateParameters>
|
192
|
-
|
193
|
-
</asp:SqlDataSource>
|
194
|
-
|
195
|
-
コード
|
196
|
-
|
197
|
-
```
|
198
10
|
|
199
11
|
|
200
12
|
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -196,31 +196,7 @@
|
|
196
196
|
|
197
197
|
```
|
198
198
|
|
199
|
-
|
199
|
+
|
200
|
-
|
201
|
-
このコードをListViewのTimeLabelにどのように記載したらよいかわかりません。
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
```//現在の時間を現地時刻で取得する
|
206
|
-
|
207
|
-
System.Console.WriteLine(System.DateTime.Now);
|
208
|
-
|
209
|
-
//Kindプロパティを確認する
|
210
|
-
|
211
|
-
System.Console.WriteLine(System.DateTime.Now.Kind);
|
212
|
-
|
213
|
-
//Local
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
//今日の日付を現地時刻で取得する
|
218
|
-
|
219
|
-
System.Console.WriteLine(System.DateTime.Today);
|
220
|
-
|
221
|
-
コード
|
222
|
-
|
223
|
-
```
|
224
200
|
|
225
201
|
環境は
|
226
202
|
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
<asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' />
|
24
24
|
|
25
|
+
<asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
|
26
|
+
|
25
27
|
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編集" />
|
26
28
|
|
27
29
|
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="削除" />
|
@@ -40,6 +42,8 @@
|
|
40
42
|
|
41
43
|
<asp:TextBox ID="ContentTextBox" runat="server" Text='<%# Bind("Content") %>' />
|
42
44
|
|
45
|
+
<asp:TextBox ID="TimeTextBox" runat="server" Text='<%# Bind("TIme") %>' />
|
46
|
+
|
43
47
|
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
|
44
48
|
|
45
49
|
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="キャンセル" />
|
@@ -64,6 +68,8 @@
|
|
64
68
|
|
65
69
|
<asp:TextBox ID="ContentTextBox" runat="server" class="textsize" Text='<%# Bind("Content") %>' />
|
66
70
|
|
71
|
+
<asp:TextBox ID="TimeTextBox" runat="server" class="textsize" Text='<%# Bind("Time") %>' />
|
72
|
+
|
67
73
|
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="投稿" />
|
68
74
|
|
69
75
|
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="クリア" />
|
@@ -86,6 +92,8 @@
|
|
86
92
|
|
87
93
|
<asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' />
|
88
94
|
|
95
|
+
<asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
|
96
|
+
|
89
97
|
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編集" />
|
90
98
|
|
91
99
|
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="削除" />
|
@@ -132,6 +140,8 @@
|
|
132
140
|
|
133
141
|
<asp:Label ID="ContentLabel" runat="server" Text='<%# Eval("Content") %>' />
|
134
142
|
|
143
|
+
<asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
|
144
|
+
|
135
145
|
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編集" />
|
136
146
|
|
137
147
|
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="削除" />
|
@@ -152,34 +162,32 @@
|
|
152
162
|
|
153
163
|
<asp:Parameter Name="name" Type="String" />
|
154
164
|
|
165
|
+
|
166
|
+
|
167
|
+
</DeleteParameters>
|
168
|
+
|
169
|
+
<InsertParameters>
|
170
|
+
|
171
|
+
<asp:Parameter Name="name" Type="String" />
|
172
|
+
|
155
173
|
<asp:Parameter Name="Title" Type="String" />
|
156
174
|
|
157
175
|
<asp:Parameter Name="Content" Type="String" />
|
158
176
|
|
177
|
+
<asp:Parameter Name="Time" Type="String" />
|
178
|
+
|
159
|
-
</
|
179
|
+
</InsertParameters>
|
160
|
-
|
180
|
+
|
161
|
-
<
|
181
|
+
<UpdateParameters>
|
182
|
+
|
183
|
+
<asp:Parameter Name="Title" Type="String" />
|
184
|
+
|
185
|
+
<asp:Parameter Name="Content" Type="String" />
|
162
186
|
|
163
187
|
<asp:Parameter Name="name" Type="String" />
|
164
188
|
|
165
|
-
<asp:Parameter Name="Title" Type="String" />
|
166
|
-
|
167
|
-
<asp:Parameter Name="Content" Type="String" />
|
168
|
-
|
169
189
|
<asp:Parameter Name="Time" Type="String" />
|
170
190
|
|
171
|
-
</InsertParameters>
|
172
|
-
|
173
|
-
<UpdateParameters>
|
174
|
-
|
175
|
-
<asp:Parameter Name="Title" Type="String" />
|
176
|
-
|
177
|
-
<asp:Parameter Name="Content" Type="String" />
|
178
|
-
|
179
|
-
<asp:Parameter Name="name" Type="String" />
|
180
|
-
|
181
|
-
<asp:Parameter Name="Time" Type="String" />
|
182
|
-
|
183
191
|
</UpdateParameters>
|
184
192
|
|
185
193
|
</asp:SqlDataSource>
|
@@ -188,7 +196,31 @@
|
|
188
196
|
|
189
197
|
```
|
190
198
|
|
191
|
-
|
199
|
+
こちらが時間を取得するのに試したコードです
|
200
|
+
|
201
|
+
このコードをListViewのTimeLabelにどのように記載したらよいかわかりません。
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
```//現在の時間を現地時刻で取得する
|
206
|
+
|
207
|
+
System.Console.WriteLine(System.DateTime.Now);
|
208
|
+
|
209
|
+
//Kindプロパティを確認する
|
210
|
+
|
211
|
+
System.Console.WriteLine(System.DateTime.Now.Kind);
|
212
|
+
|
213
|
+
//Local
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
//今日の日付を現地時刻で取得する
|
218
|
+
|
219
|
+
System.Console.WriteLine(System.DateTime.Today);
|
220
|
+
|
221
|
+
コード
|
222
|
+
|
223
|
+
```
|
192
224
|
|
193
225
|
環境は
|
194
226
|
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -140,7 +140,49 @@
|
|
140
140
|
|
141
141
|
</SelectedItemTemplate>
|
142
142
|
|
143
|
-
</asp:ListView>
|
143
|
+
</asp:ListView>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<asp:SqlDataSource ID="xxx" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SELECT * FROM [xxx]" DeleteCommand="DELETE FROM [xxx] WHERE [name] = @name" InsertCommand="INSERT INTO [xxx] ([name], [Title], [Content],[Time]) VALUES (@name, @Title, @Content)" UpdateCommand="UPDATE [xxx] SET [Title] = @Title, [Content] = @Content,[Time] = @Time WHERE [name] = @name">
|
150
|
+
|
151
|
+
<DeleteParameters>
|
152
|
+
|
153
|
+
<asp:Parameter Name="name" Type="String" />
|
154
|
+
|
155
|
+
<asp:Parameter Name="Title" Type="String" />
|
156
|
+
|
157
|
+
<asp:Parameter Name="Content" Type="String" />
|
158
|
+
|
159
|
+
</DeleteParameters>
|
160
|
+
|
161
|
+
<InsertParameters>
|
162
|
+
|
163
|
+
<asp:Parameter Name="name" Type="String" />
|
164
|
+
|
165
|
+
<asp:Parameter Name="Title" Type="String" />
|
166
|
+
|
167
|
+
<asp:Parameter Name="Content" Type="String" />
|
168
|
+
|
169
|
+
<asp:Parameter Name="Time" Type="String" />
|
170
|
+
|
171
|
+
</InsertParameters>
|
172
|
+
|
173
|
+
<UpdateParameters>
|
174
|
+
|
175
|
+
<asp:Parameter Name="Title" Type="String" />
|
176
|
+
|
177
|
+
<asp:Parameter Name="Content" Type="String" />
|
178
|
+
|
179
|
+
<asp:Parameter Name="name" Type="String" />
|
180
|
+
|
181
|
+
<asp:Parameter Name="Time" Type="String" />
|
182
|
+
|
183
|
+
</UpdateParameters>
|
184
|
+
|
185
|
+
</asp:SqlDataSource>
|
144
186
|
|
145
187
|
コード
|
146
188
|
|