ConfigurationManager.AppSettings("configValue")
Web.Config
<dxwgv:GridViewCommandColumn VisibleIndex="0">
<CustomButtons>
<dxwgv:GridViewCommandColumnCustomButton ID="Remove" Text="Remove">
</dxwgv:GridViewCommandColumnCustomButton>
</CustomButtons>
</dxwgv:GridViewCommandColumn>
<dxwgv:ASPxGridView runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ID="gridUserRoles" EnableCallBacks="False"><Columns> <dxwgv:GridViewCommandColumn VisibleIndex="0"> <CustomButtons> <dxwgv:GridViewCommandColumnCustomButton ID="Remove" Text="Remove"> </dxwgv:GridViewCommandColumnCustomButton> </CustomButtons> </dxwgv:GridViewCommandColumn> <dxwgv:GridViewDataTextColumn FieldName="RoleID" VisibleIndex="1"> </dxwgv:GridViewDataTextColumn> </Columns> </dxwgv:ASPxGridView>
Next -
We need to define the Event in the code behind. Create a new CustomButtonCallBack Method, which will serve as a handler for any custom actions that fire.
Finally, we use the Event Args of the Gridview custom button, to find our newly created button. The Event args are referenced when then new CustomButtonCallBack method is created, so we dont even need to worry about creating that.
Protected Sub gridUserRoles_CustomButtonCallback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs) Handles gridUserRoles.CustomButtonCallback If e.ButtonID <> "Remove" Then Return
Else
‘Code for removing users role