sætte CommandField.ShowDeleteButton for hver række i codebehind
Hej
Jeg har i øjeblikket følgende:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim CheckBox1 As CheckBox = (CType(e.Row.FindControl("CheckBox1"), CheckBox)) If CheckBox1.Checked = False Then CType(GridView1.Columns(0), CommandField).ShowDeleteButton = False End If End If End Sub
mit problem er at den sætter showdeletebutton til false ved alle rækker. den skal kun sættes til false der hvor CheckBox1.Checked = False?
Virksomheder er på vej fra store sprogmodeller, der svarer på spørgsmål, til AI-agenter, der kan udføre opgaver på egen hånd. Det gør teknologien mere nyttig – og langt mere risikabel.
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim CheckBox1 As CheckBox = (CType(e.Row.FindControl("CheckBox1"), CheckBox)) If CheckBox1.Checked = False Then Dim SelectButton As LinkButton = CType(e.Row.Cells(0).Controls(0), LinkButton) SelectButton.Visible = False Dim DeleteButton As LinkButton = CType(e.Row.Cells(0).Controls(2), LinkButton) DeleteButton.Visible = False End If End If End Sub
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.