user3451380 user3451380 - 3 months ago 24
C# Question

Pass texbox value to controller

I'm planing to design star rating control in MVC. I've design input text to store rating value. I want to pass the input text with action link.

How to do that?

<input type="text" name="votenumber" class="ratingEvent rating5" value="5" />
<div><b id="result">5</b> start(s)</div>

@Html.ActionLink("Vote", "Vote", "Home")

Pass the input value to the action link or better idea pass to controller?

b id= result
will immediately change value when user selected others value.


I think so , the better way is use jquery ajax and send it via this , such as this code

$('form').submit(function () {
        url: '/Home/Vote',
        type: 'GET',
        data: { search: $('#your text box').val()},
        success: function (result) {
            $('#your result div').html(result);
    return false;