I have the follwoing function which loops through 3 datagrids on my page and should disable all other edit buttons when one edit button is clicked.
VB Code:
Protected Sub DisableEdit() Dim c As Control Dim content As ContentPlaceHolder content = Page.Master.FindControl("contentplaceholder1") Dim grid As GridView Dim frow As GridViewRow For Each c In content.Controls If c.GetType() Is GetType(GridView) Then grid = CType(c, GridView) For Each frow In grid.Rows If (frow.RowType = DataControlRowType.DataRow) Then If Not frow.RowState = DataControlRowState.Edit Then Dim btnEdit As LinkButton = frow.Cells(8).Controls(0) btnEdit.Enabled = False End If End If Next End If Next End Sub
I call this on the RowEditing of each gridview, unfortunately RowEditing Occurs when a row's Edit button is clicked, but before the GridView control enters edit mode. Which means it turns them all to false but re-binds the gridview that called the fucntion, which in turn renders all fo the controls visible.
Does anyone know of a workaround for this, or the correct event to use that will fire after the control enters edit mode




Reply With Quote