How to assign UpdatePanel Trigger's control ID with button's from gridview

前端 未结 4 2041
轮回少年
轮回少年 2021-01-24 21:21

currently I have a UpdatePanel for jQuery Dialog use, which contains a GridView.

And that GridView contains a FileUpload control in footer and EmptyDataTemplate

4条回答
  •  没有蜡笔的小新
    2021-01-24 22:09

    I had a similar problem and this post helped me, but I found that registering the control in the scriptmanager works only if the updatepanels UpdateMode is set to "Always". If its set to "Conditional" this approach does not work.

    I found another approach that always works which is to add triggers to the updatepanel in the DataBound() event of the gridview:

        Dim CheckBoxTrigger As UpdatePanelControlTrigger = New AsyncPostBackTrigger()
        Dim SelectCheckBox As CheckBox
        For i = 0 To GridViewEquipment.Rows.Count - 1 Step 1
            SelectCheckBox = GridViewEquipment.Rows(i).Cells(12).FindControl("CheckBoxSign")
            CheckBoxTrigger.ControlID = SelectCheckBox.UniqueID
            UpdatePanelEquipment.Triggers.Add(CheckBoxTrigger)
        Next
    

提交回复
热议问题