發表文章

目前顯示的是 1月, 2019的文章

GridView ButtonField 確認提醒

Dim btnDelete As Button = CType((e.Row.Cells(2).Controls(0)), Button) btnDelete.OnClientClick = "if(!confirm('你確定要刪除這個帳號嗎!?')) return false;"

CheckBox GridView 動態產生

Protected Sub gv_account_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles gv_account.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim ck = New CheckBox ck.ID = "Scheck" e.Row.Cells(1).Controls.Add(ck) End If End Sub 抓值方式 Sub PermissionCheck() Dim gvr As GridViewRow Dim KeyName As String For Each gvr In gv_account.Rows Dim cb As CheckBox = CType(gvr.FindControl("Scheck"), CheckBox) If cb.Checked = True Then KeyName = gv_account.DataKeys(gvr.RowIndex).Values(0) End If Next End Sub