I having problem when I try to pass value from ImageButton to a controlparameter, then the update command can retrieve the value from control parameter to execute update statement.
I want to pass value Status=1 when ImageButton APPROVE is clicked, else pass value Status=2 when ImageButton REJECT is clicked.
Where and how should I assign value Status? When I run my code, I receive this error : Must declare the scalar variable "@Status".
Or any recommendation to pass the value Status?
My ImageButton:
<ItemTemplate>
<asp:ImageButton runat="server" ID="APPROVE" CommandName="update"
ImageUrl="~/images/accept.png"
OnClientClick="if (!window.confirm('Are you sure you want to approve this booking?')) return false;" />
</ItemTemplate>
<ItemTemplate>
<asp:ImageButton runat="server" ID="REJECT" CommandName="update"
ImageUrl="~/images/reject.png"
OnClientClick="if (!window.confirm('Are you sure you want to reject this booking?')) return false;" />
</ItemTemplate>
My UPDATE statement
UpdateCommand="UPDATE [bookingschedule] SET status=@Status WHERE [bookingScheduleID] = @bookingScheduleID"
My ControlParameter
<UpdateParameters>
<asp:Parameter Name="bookingScheduleID" Type="Int32" />
<asp:ControlParameter Name="Status" ControlID="APPROVE" Type="Int32" />
<asp:ControlParameter Name="Status" ControlID="REJECT" Type="Int32" />
</UpdateParameters>