I want to add a Record Delete Message when the Delete button is selected. The message would appear for 5 seconds, then disappear. Here’s the code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" DataSourceID="SqlDataSource1"
AutoGenerateColumns="False" DataKeyNames="ScheduleId">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="SDate" HeaderText="SDate" SortExpression="SDate" />
<asp:BoundField DataField="STime" HeaderText="STime" SortExpression="STime" />
<asp:BoundField DataField="SNoPlaces" HeaderText="SNoPlaces"
SortExpression="SNoPlaces" />
<asp:BoundField DataField="ScheduleId" HeaderText="ScheduleId"
InsertVisible="False" ReadOnly="True" SortExpression="ScheduleId" Visible="false" />
<asp:BoundField DataField="STourId" HeaderText="STourId" SortExpression="STourId" Visible="false" />
<asp:BoundField DataField="TName" HeaderText="Tour Name" SortExpression="TName" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ChinatowndbConnString %>"
DeleteCommand="DELETE FROM Schedule WHERE (ScheduleId = @ScheduleId)"
SelectCommand="SELECT SDate, STime, SNoPlaces, ScheduleId, STourId, TName FROM Schedule INNER JOIN Tour ON Schedule.STourId = Tour.TourId">
<DeleteParameters>
<asp:Parameter Name="ScheduleId" />
</DeleteParameters>
</asp:SqlDataSource>
Regards
Tea
Use this gridview event:
I would use jQuery to always Fadeout the LabelMsg element on $(document).ready(). So no matter what you put in it, from the server side, it will fade out in the time you decide.