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

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -