加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – Layout.cshtml上的ASP.NET MVC搜索框

发布时间:2020-12-16 10:02:05 所属栏目:asp.Net 来源:网络整理
导读:我已经创建了搜索表单和 http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application的结果,它使用PagedList Nuget包处理分页和排序. 我需要帮助的是,如何
我已经创建了搜索表单和 http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application的结果,它使用PagedList Nuget包处理分页和排序.

我需要帮助的是,如何将搜索表单放在我的母版页上? (_layout.cshtml)?

解决方法

put a包含一个Text框和一个按钮,表单的动作将是搜索动作

_layout.cshtml页面中的Ex代码

@using(Html.BeginForm("ActionName","ControllerName",FormMethod.Get))
{
    @Html.TextBoxFor(m => m.Query)

    <div>
        <input type="submit" value="Search" />
    </div>
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读