0

ASP.Net / VB.Net コード ビハインド Web フォームがあります。このフォームには、GridView と DetailsView があります。

詳細ビューに変更があった場合、その変更を GridView に反映させたいと考えています。

このコードは、GridView を設定するために使用されています。

Private Sub Teachers_Init(sender As Object, e As EventArgs) Handles Me.Init

    ' Load the data from the database into the GridView.
    '---------------------------------------------------
    GridViewSummary.DataSource = theTableAdapter.GetDataAllTeachers
    GridViewSummary.DataBind()
End Sub

このコーディングは、DetailsView で詳細に変更が加えられた後、GridView の変更を反映するために使用されています。

Private Sub DetailsView_ItemUpdated(sender As Object, e As DetailsViewUpdatedEventArgs) Handles DetailsView.ItemUpdated

    ' Refresh the data so current values are displayed.
    '--------------------------------------------------
    GridViewSummary.DataSource = theTableAdapter.GetDataAllTeachers
    GridViewSummary.DataBind()
End Sub

以下の使用を必要としない方法はありますか?

    GridViewSummary.DataSource = theTableAdapter.GetDataAllTeachers

上記のコーディングで?たった 1 行のコードであることはわかっていますが、不要であれば削除したいと考えています。

4

0 に答える 0