My MVC view has a table with an editable field as follows.
<td>
<div class="view">
<%= Model.device_Url%>
</div>
<div class="edit">
<input type="text" name="deviceurl" id = "deviceurl" value="<%= Model.device_Url%>" />
</div>
</td>
The user has the option to edit then save the value entered in the above text box field.
<td class="options">
<div class="view">
<a href="#" class="switchToEdit">Edit</a>
</div>
<div class="edit">
<a href="/Live/Update?streamurl=deviceurl class="save refresh">Save</a>
<a href="#" class="cancel">Cancel</a>
</div>
</td>
I would like to call my controller /Live/Update and pass in the value changed in the text box in the URL.
How would I get the value entered inthe text box.
Do I need java script to do this?
You will need javascript unless you want to use a traditional submit.
The easiest approach would be to use jQuery and get the value with a line of code similar to this:
I would then make an ajax call to submit the value back to your controller’s action. You also probably want to use the Url.Action helper to build the Url:
Hope this helps