javascript - redirecting to another controller with onchange -


<th>@html.dropdownlist("tables", new list<selectlistitem> {     new selectlistitem { text = "a", value = "admin/index"},     new selectlistitem { text = "b", value = "admin/index"} }, "www",new { @onchange="location=this.value" })</th> 

this code works 1st time, later instead redirect controller "admin/index" starts copy itself.so have address this

localhost/admin/admin/index instead of localhost/admin/index 

i have tried, same effect

@onchange="document.href.location=this.value @onchange="window.href.location=this.value 

how make correct js, redirecting work time.

you can add slash values, starts root:

<th>@html.dropdownlist("tables", new list<selectlistitem> {     new selectlistitem { text = "a", value = "/admin/index"},     new selectlistitem { text = "b", value = "/admin/index"} }, "www",new { @onchange="location=this.value" })</th> 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -