PDA

View Full Version : [CLOSED] MVC Razor GridPanel Row DoubleClick



leonardm
Jul 24, 2013, 5:43 PM
Hi,

I have a GridPanel in my view that I want to "wire-up" the row double-click event for.

Whenever the user double clicks a row on the grid, I want to call a Direct Event on my controller and pass the Id (in the extra parameter?). This Id is the record id (and a hidden column in the grid).

Can you provide some sample code (MVC and Razor) to do this?

Thanks,
Leo

leonardm
Jul 24, 2013, 11:06 PM
Hi,

I have a GridPanel in my view that I want to "wire-up" the row double-click event for.

Whenever the user double clicks a row on the grid, I want to call a Direct Event on my controller and pass the Id (in the extra parameter?). This Id is the record id (and a hidden column in the grid).

Can you provide some sample code (MVC and Razor) to do this?

Thanks,
Leo

I figured it out: Here's the code fragment


@(X.GridPanel()
.Layout(LayoutType.Fit)
.Border(false)
.BodyBorder(0)
.DirectEvents(de =>
{
de.ItemDblClick.Url = "/List/Details";
de.ItemDblClick.CleanRequest = true;
de.ItemDblClick.Method = HttpMethod.GET;
de.ItemDblClick.ExtraParams.Add(new Parameter("id", "record.get('Id')", ParameterMode.Raw));
})

....

Baidaly
Jul 24, 2013, 11:15 PM
Hello!

Thank you for your update and solution. Please, don't forget to wrap your code in CODE tag.

Thank you!