ASP.NET MVC - how to get the value from a textbox in my View?

Posted by fearofawhackplanet on Stack Overflow See other posts from Stack Overflow or by fearofawhackplanet
Published on 2010-06-14T12:14:42Z Indexed on 2010/06/14 12:22 UTC
Read the original article Hit count: 152

Filed under:
|
|
|

If I have a textbox in my view:

<div><%= Html.TextBox("Comments", Model.Comments)%></div>

I want to post the contents of this textbox to the controller with an Ajax call. I only need this one value though, so I don't want to post the whole form back.

<%= Ajax.ActionLink("update", "UpdateComments", 
                new { comments = /* ????? */ }, 
                new AjaxOptions { HttpMethod="POST" })%>

How do I get the textbox value?

© Stack Overflow or respective owner

Related posts about c#

Related posts about html