Accept と Reject の 2 つの画像ボタンがあります。[承認] ボタンは [ステータス] を 1 に更新します [拒否] ボタンは [ステータス] を 2 に更新します
UpdateCommand を使用して Accept ボタンを更新することに成功しました
UpdateCommand="UPDATE [bookingschedule] SET status='1'WHERE [bookingScheduleID] = @bookingScheduleID"
しかし、UpdateCommand を 1 回しか宣言できないため、拒否ボタンの更新コマンドを設定する方法がわかりません。
UpdateCommand2="UPDATE [bookingschedule] SET status='2'WHERE [bookingScheduleID] = @bookingScheduleID" (incorrect)
拒否ボタンを機能させるにはどうすればよいですか? この 2 番目の更新コマンド ラインはどこに置くべきですか。
UpdateCommand="UPDATE [bookingschedule] SET status='2'WHERE [bookingScheduleID] = @bookingScheduleID"
このコーディングはすべてクライアント側で行います。
同意ボタン:
<asp:TemplateField HeaderText="Action Approve">
<ItemTemplate>
<asp:ImageButton runat="server" ID="UpdateCommand"
CommandName="update" ImageUrl="~/images/accept.png"
OnClientClick="if (!window.confirm('Are you sure you want to approve this booking?')) return false;" />
</ItemTemplate>
</asp:TemplateField>
拒否ボタン:
<asp:TemplateField HeaderText="Action Reject">
<ItemTemplate>
<asp:ImageButton runat="server" ID="UpdateCommand" CommandName="update" OnClick="reject"
ImageUrl="~/images/reject.png"
OnClientClick="if (!window.confirm('Are you sure you want to reject this booking?')) return false;" />
</ItemTemplate>
</asp:TemplateField>
SQL データソース:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
SelectCommand="SELECT [bookingScheduleID], [eventTitle], [week1], [week2], [week3], [week4], [week5], [week6], [week7], [week8], [exhibitorname], [boothAlias], [category], [status], [dateBook],[custNo] FROM [booking_all]"
UpdateCommand="UPDATE [bookingschedule] SET status='1'WHERE [bookingScheduleID] = @bookingScheduleID"
>
</asp:SqlDataSource>
<UpdateParameters>
<asp:Parameter Name="bookingScheduleID" Type="Int32" />
</UpdateParameters>