I’m using the asp.net MVC pattern of having a url like controller/action/id. This works fine if I navigate to the url directly.
I want to have a page where the user can input the id and click a button (or link) which takes them to the correct url.
Do I need to somehow make an action link that points to a varying url based on the input using some client-side script?
Or can I render a Form that GETs the correct url?
Is what I’m doing unusual; should I be doing something else? (Note that the number of ids is too long to list).
Assuming you have the default route set up, you can do the following client-side script (make sure it’s in the same file though):
Then assuming your button has the id
myButtonand the textbox has the idmyTextBox, you can do this jQuery: