Home » .NET 4.0 » Record Update Confirmation Message

Record Update Confirmation Message

DataSource connection string

<asp:sqldatasource ID="MySQLDS" runat="server" 
ConnectionString="< %$ ConnectionStrings:MyConnString %>" 
UpdateCommand="UPDATE [MyTablel] 
SET 
[DATE_SUBMITTED] = @DATE_SUBMITTED WHERE [RID] = @RID" 
OnUpdated="UpdateMessage" >
</asp:sqldatasource>
VB code in a head section of the page

<head>
<script runat="server">
    Sub UpdateMessage(ByVal source As Object, ByVal e As SqlDataSourceStatusEventArgs)
        If e.AffectedRows > 0 Then
            ' Perform any additional processing, 
            ' such as setting a status label after the operation.        
            Label1.Text = "- Information updated successfully!"
        Else
            Label1.Text = "No data updated!"
        End If
    End Sub 'UpdateMessage
</script>
</head>

Label - message display

<asp:Label ID="Label1" runat="server" CssClass="error" >