Here is an small example of how to perform an action when the row is clicked. To accomplish this, you need to use the .SetOnSelectedRowEvent. In here, you can put your javascript function name, or the function directly.

The APIpassed the id column in a variable named surprisingly, 'id'

For example, if you wanted to goto a details page whenever you clicked on a row:

.SetOnSelectedRowEvent("window.location.href ='Members/Details/'+id;")
Or a full example

@Html.Grid(new GridControl()
            .SetOnSelectedRowEvent("window.location.href ='Members/Details/'+id;")
            .SetColumns<Website.Models.MemberModels.MemberModel>(cs =>
                    cs.Add(x => x.MemberID).SetAsPrimaryKey().SetHidden(true);
                    cs.Add(x => x.Rank);
                    cs.Add(x => x.LastName);
                    cs.Add(x => x.Initials);                    

In this case, the MemberID is passed as the 'id' variable in the function

Last edited Jun 3, 2011 at 5:18 PM by PhilmanCJ, version 1


AdrianoRR Oct 11, 2011 at 4:33 PM 
Now that i've tested it again, it seems that my function is being called twice. The first call works fine, but the second throws a "is not a function" error.

AdrianoRR Oct 11, 2011 at 2:32 PM 
How can i define properly a function to be called by the OnSelectedRowEvent? I've tried using a simple Test(id) which alerts the id selected. Even though it works, i still get a "Test(id) is not a function" error (seen this using firebug). How can i prevent this error from ocurring?