Accessing a ASPxButton in a DataItemTemplate in when row is bound
I have a aspxgridview that shows a number of buttons for each row. What I want to be able to do is enable some of these buttons on a per row basis, based on some background logic. When the HtmlRowPrepared event is trapped I tru and use e.Row.FindControl("butApprove") but it returns null. If I keep searching down through the Controls collection several times I can find the control with that id.
Is there an easier way of doing this as I am new to th开发者_如何学编程e DevExpress controls.
<dx:GridViewDataButtonEditColumn VisibleIndex="4">
<DataItemTemplate>
<dx:ASPxButton ID="butAddNote" runat="server" Text="Add Note"></dx:ASPxButton>
<dx:ASPxButton ID="butEditContact" runat="server" Text="Edit Contact"></dx:ASPxButton>
<dx:ASPxButton ID="butApprove" runat="server" Text="Approve"></dx:ASPxButton>
<dx:ASPxButton ID="butReject" runat="server" Text="Reject"></dx:ASPxButton>
</DataItemTemplate>
</dx:GridViewDataButtonEditColumn>
Many thanks
Jonathan
I suggest that you use the HtmlRowCreated event and access buttons using the ASPxGridView.FindRowCellTemplateControl method.
精彩评论