开发者

ASP.NET MVC - Redirect/Post on Dropdown list change. Add to Route Values?

I have a dropdown list bound to some Viewdata. When a user changes the value, I'd like to essentially add the value of the dropdown to the routevalue dictionary so it's a parameter but keep the existing routevalues in place.

Right now I've got it so changing the value forces the page to post as follows:

@Html.DropDownList("Regions", Nothing, New With {.onchange = "this.form.submit();"})

This obviously isn't what I want as I've had to repeat the code in the post section in the controller and I lose the other routevalues.

Is there anyway I can amend the .onchange part so it sends the va开发者_高级运维lue of the dropdown through to the routevalues and refreshes the page?


I ended up resolving this by manually constructing the parameter string using Javascript and using window.location.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜