This documentation is archived and is not being maintained.

SqlDataSourceView.Updated Event

Occurs when an update operation has completed.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public event SqlDataSourceStatusEventHandler Updated

Handle the Updated event to examine the values of output parameters after an update operation has completed. The output parameters are available from the SqlDataSourceStatusEventArgs object that is associated with the event.

For more information about handling events, see Consuming Events.

The following code example demonstrates how to display and update data that is retrieved from an ODBC database in a GridView control. After a record is successfully updated, the Updated event is handled by an event handler to perform a post-processing step where an e-mail message notification is sent.

<%@Page  Language="C#" %>
<%@Import Namespace="System.Web.Mail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

 private void OnDSUpdatedHandler(Object source, SqlDataSourceStatusEventArgs e) {
    if (e.AffectedRows > 0) {
        // Perform any additional processing, such as sending an e-mail notification.
        Label1.Text = Request.LogonUserIdentity.Name +
            " changed user information sucessfully!";
    else {
        Label1.Text = "No data updated!";

<html xmlns="" >
  <head runat="server">
    <title>ASP.NET Example</title>
    <!-- This example uses a Northwind database that is hosted by an ODBC-compliant
         database. To run this sample, create an ODBC DSN to any database that hosts
         the Northwind database, including Microsoft SQL Server or Microsoft Access,
         change the name of the DSN in the ConnectionString, and view the page.
    <form id="form1" runat="server">

          SelectCommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
          UpdateCommand="Update Employees SET FirstName=?,LastName=?,Title=? WHERE EmployeeID=?"

              <asp:BoundField HeaderText="First Name" DataField="FirstName" />
              <asp:BoundField HeaderText="Last Name" DataField="LastName" />
              <asp:BoundField HeaderText="Title" DataField="Title" />



Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0