views:

276

answers:

1

I have a MVCContrib grid that shows selected properties from an Account object. I want the user to select a row and be taken to another page to view the full properties of the object represented by the row they clicked. How do I add a .Selected action to the rows of the grid?

A: 

Hi There,

I just came across a similar problem today.

You can use the .RowAttributes Like so:

Html.Grid(Model).Columns(column => { column.For(e => e.Id); column.For(e => e.Message); }).RowAttributes(x=> new Dictionary<string, object>{{"onClick", "window.location.href = 'google.com'"}}).Render();

In result, when you click on a it will trigger the javascript "onclick" and open up google. You can change the url to pass in an Id by using the "x" in the Lamda.

Chi Chan