如何在asp.net MVC 3使用@ html.actionlink传递到文本框的值 [英] How to Pass textbox value using @html.actionlink in asp.net mvc 3

查看:318
本文介绍了如何在asp.net MVC 3使用@ html.actionlink传递到文本框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net MVC3使用@ html.actionlink从文本传递价值?

How to Pass value from text using @html.actionlink in asp.net mvc3 ?

推荐答案

而不是通过使用@ Html.actionlink你的价值,尝试了jQuery的文本框的值传递给控制器​​:

Rather than passing your value using @Html.actionlink, try jquery to pass your textbox value to the controller as:

$(function () {
    $('form').submit(function () {
        $.ajax({
            url: this.action,
            type: this.method,
            data: { search: $('#textboxid').val()},
            success: function (result) {
                $('#mydiv').html(result);
            }
        });
        return false;
    });
});

这code将您的文本框的值张贴到控制器,并返回将在DIV中加载输出结果mydiv。

This code will post your textbox value to the controller and returns the output result which will be loaded in the div "mydiv".

这篇关于如何在asp.net MVC 3使用@ html.actionlink传递到文本框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆