Is it possible to use the event RowGetButtonVisibility in ASP.NET MVC?
In “normal” ASP.NET DevExpress is using this like described here:
I want to have the possibility to show/hide the detail button within the GridView.
Any ideas to do this?
Something like this is not working:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<FOO>" %>
<%
Html.DevExpress().GridView(settings =>
{
settings.Name = "resultsTable";
settings.KeyFieldName = "ResultId";
settings.CallbackRouteValues = new { Controller = "Results", Action = "ResultsPartial" };
settings.Width = Unit.Percentage(100);
settings.Height = Unit.Percentage(100);
//...
settings.PreRender = (sender, e) =>
{
MVCxGridView grid = (MVCxGridView)sender;
grid.DetailRowGetButtonVisibility += (s_, e_) =>
{
if (some_condition == true)
e_.ButtonState = GridViewDetailRowButtonState.Hidden;
};
};
})
.Bind(Model.Results)
.Render();
I solved my problem as described in the DevExpress-Forum here:
http://community.devexpress.com/forums/p/105806/358003.aspx#358003
My first try with attaching to the event was right, but not at PreRender. DataBound is the right event to use.