在PostBack上清除GridView数据

时间:2017-05-18 06:57:44

标签: c# asp.net vb.net gridview

我正在加载.aspx中的用户control以显示gridView并在代码后面的列中动态创建CheckBox模板字段。每当我checkuncheck时,autopostbacktriggered

由于我在page_load中绑定()网格,它会在回发后跳过重新绑定gridView(如果添加了Not IsPostback()条件)。

如何在PostBack后保留GridView中的Checkbox更改数据?用户control与其他标签和文本框控件一起放在aspx中。

请建议如何在回发后重新获取此代码中的GridView数据:

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim Values(5) As String
    Dim totalCount As Integer
    Dim dtcustAcctSignRelation = New DataTable()
    Dim lstCustInfo As ArrayList = TryCast(Session("CustInfo"), ArrayList)
    Dim i As Integer = 0

    If Not Page.IsPostBack Then
        For Each value As String In lstCustInfo
            Values(i) = value
            i = i + 1
        Next

        Calendar1.Visible = False

        lstRegInfo = CType(Session("secureURL"), Global.System.Collections.Generic.List(Of String))

        HideLeftPanelFromMasterPage()
        InitializeCustInfoPanel(Values)
        dtcustAcctSignRelation = RetrieveBSUCustomer(Values, 1, totalCount, dtcustAcctSignRelation) '*** Getting DataTable values
        LoadGridViewSignatoryGroup(Values(0).ToString(), dtcustAcctSignRelation) '*** Creating Template Fields and binding data to GridView
    End If
End Sub

0 个答案:

没有答案