This is a migrated thread and some comments may be shown as answers.

[Solved] Selectable doesn't allow rows to be selected?

0 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 14 Oct 2011, 09:53 PM
My goal:  To allow a user to select a row and fire an ActionResult in the controller with the values of the selected row.

Code to get the event to fire javascript, which isn't what I want but would at least prove that Telerik is smart enough to see the row get selected (copied from google searches I found):

@(Html.Telerik().Grid(Model)

.Name(

"Grid")

.DataKeys(keys => keys.Add(x => x.Name))

.Columns(columns =>

{

columns.Bound(x => x.Name).Width(50);

columns.Bound(x => x.Type).Width(50);

})

.Sortable()

.Selectable()

.ClientEvents(events => events.OnRowSelected("onRowSelected"))

 

<script type="text/javascript">

function onRowSelected(e) {

    //var id = e.row.cells[0].innerHTML;

    alert("foo");
}

</script>

But even that doesn't work.  Does .Selectable() not make the rows selectable as it would imply?  It's Telerik.Web.Mvc version 2011.2.914.340.  I have used Telerik grids in the past, but only for editing, inserting, or deleting rows in a table.

 

Tags
Grid
Asked by
James
Top achievements
Rank 1
Share this question
or