Problem with SetOnSelectedRowEvent...

Jul 12, 2011 at 4:47 PM

Hello...

I need to use Url.Action in SetOnSelectedRowEvent?

I need to do something like that:

 .SetOnSelectedRowEvent("window.History.pushState(null, null, '@Url.Action("Edit","Meta")' + id);")

Thanks

 

Coordinator
Jul 12, 2011 at 5:49 PM
Edited Jul 12, 2011 at 5:50 PM

You should supply the SetOnSelectedRowEvent method a js function name that the grid will invoke when a row's selected.
e.g:

...SetOnSelectedRowEvent("onRowSelected")...

And somewhen in the page you should have the following script tag:

<script language="javascript" type="text/javascript">
function onRowSelected(selectedRowModel)
{
/* Your code here */
}
</script>
Jul 12, 2011 at 7:44 PM

Thanks...

I did that :

function onRowSelected(selectedRowModel) {
        window.History.pushState(null, null, "@Url.Action("Edit","Meta")" +'/'+ selectedRowModel.Id);
    }

Worked, but i dont know if its the best way...

Another question with the same subject...

Is it posible to set the SetListUrl with Url.Action ? I´m with a odd problem using that :

 .SetListUrl("Meta/List")

When I access my page like that : localhost/Meta everthing works great... http://localhost/Meta/List?

But when I try that : localhost/Meta/ my SetListUrl does no work... It try to get from : http://localhost/Meta/Meta/List?

Any idea?

Thanks

 

Coordinator
Jul 13, 2011 at 6:43 AM

Shouldnt thid do the work: .SetListUrl(Url.Action("Edit",Meta"))... ?

As for the onRowSelected - if you have a better design offer I'd love to hear it

Jul 13, 2011 at 12:17 PM

.SetListUrl(Url.Action("Edit",Meta")) worked fine... Thanks...

I´m trying to do something like that :

.SetOnSelectedRowEvent( "window.History.pushState(null, null," + "'" + Url.Action("Edit", "Meta") + "/id')")

But that generates :

http://localhost/Meta/Edit/id

Paul

Jul 13, 2011 at 2:44 PM

Yeah! I did it...

.SetOnSelectedRowEvent( "window.History.pushState(null, null," + "'" + Url.Action("Edit", "EmpresaContratada") + "/' + id)")

 

Thanks