Completing and Testing the EditDataGrid.aspx ASP.NET Web Page

At this point we have nearly completed the EditDataGrid.aspx Web page. All that remains is to add the Page_Load event handler. The Page_Load event handler needs to bind the data from the GetCustomers() function to the DataGrid only when there is not a postback. Therefore, just as in Hours 18 and 19, our Page_Load event handler must look like this:

Sub Page_Load(sender as Object, e as EventArgs)
   If Not Page.IsPostBack then
      dgCustomers.DataSource = GetCustomers()
      dgCustomers.DataBind()
   End If
End Sub

Take a moment to add this code to the EditDataGrid.aspx Web page's source code portion.

Once the Page_Load has been added, we're ready to test the editable DataGrid. Start by viewing ...

Get SAMS Teach Yourself ASP.NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.