tags:

views:

25

answers:

2

I've tried the bare method and the T4MVC method but so far both are routing me to the current URL instead of the default path with no arguments for the following action:

    public virtual ActionResult Index(byte? location, int? sublocation)
    {
    }

So when I try

 Url.Action("Index","Locations", new {location="", system=""})

if I'm at a location already this method returns the path to where I'm already at instead of the default path with no arguments. As does the following method with T4MVC.

    <input type="button" value="Go" style="display:none" onclick="window.location='<%=
Url.Action(MVC.Controller.Index()) 
%>/'+$('input#location').val()+'/'+$('input#sublocation').val()+'/';" />

How can I get the default route with no arguments?

A: 

Try Url.Action("Index","Locations")

Malcolm Frexner
I have, still no luck =(
Maslow
What does the link render?
Malcolm Frexner
the actual page I'm on including arguments.
Maslow
A: 

a 'working' work around:

<input type="button" value="Go" style="display:none" onclick="window.location='<%=
Url.Action("Index","Location")
%>/'.replace(/\/[0-9]+\/[0-9]+\/?/g,'/') 
<%-- undecided option here to remove subsequent arguments .replace(/\?.*/,'')--%>
+$('input.location:first').val()+'/'+$('input.subLocation:first').val()+'/';" />
Maslow