Using DevExpress\'s GridView, I would like to trigger a (clientside) event when a cell is selected (or simply clicked on).
There already is a way to get the click ev
It is possible to attach the required client-side handler for an individual DataCell by handling the GridViewSettings.HtmlDataCellPrepared event:
function OnCellClick(visibleIndex, fieldName) {
alert(visibleIndex + " " + fieldName);
}
@Html.DevExpress().GridView(settings => {
...
settings.HtmlDataCellPrepared = (sender, e) => {
e.Cell.Attributes.Add(
"onclick",
string.Format("OnCellClick('{0}', '{1}');", e.VisibleIndex, e.DataColumn.FieldName)
);
};
}).Bind(Model).GetHtml()