C# 使用AJAX和standard时,搜索表单的显示方式不同
当我像这样使用引导搜索表单时,我得到以下输出(如我所愿):C# 使用AJAX和standard时,搜索表单的显示方式不同,c#,html,css,razor,C#,Html,Css,Razor,当我像这样使用引导搜索表单时,我得到以下输出(如我所愿): @使用(Html.BeginForm(“Search”、“Show”、FormMethod.Get、new{@class=“form Search”})){ } 但是,当我想将其转换为ajax表单时,我会收到以下输出: @using (Ajax.BeginForm( new AjaxOptions { HttpMethod = "GET", InsertionMode = Insert
@使用(Html.BeginForm(“Search”、“Show”、FormMethod.Get、new{@class=“form Search”})){
}
但是,当我想将其转换为ajax表单时,我会收到以下输出:
@using (Ajax.BeginForm(
new AjaxOptions {
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "contentlist"
})) {
<div class="input-append">
<input type="search" class="span2 search-query" name="query" />
<input type="submit" class="btn" value="Search" />
</div>
}
@使用(Ajax.begin)(
新选择{
HttpMethod=“GET”,
InsertionMode=InsertionMode.Replace,
UpdateTargetId=“contentlist”
})) {
}
为什么形式的类型会有所不同?生成的HTML在这两种情况下是相同的
编辑:解决了,我是个笨蛋。我认为ajax表单没有类名。您应该添加
class=“formsearch”
我认为ajax表单没有类名。您应该添加class=“form search”
您确定生成的HTML是相同的吗?当附加控件之间存在某些内容时,引导会执行此操作。您确定生成的HTML是相同的吗?当附加的控件之间存在某种东西时,引导就会这样做。好吧,这就解决了它。完全忽略了这一点,我错过了几个数据标记之间的class
标记。我会在几分钟内接受答案。好吧,这就解决了。完全忽略了这一点,我错过了几个数据标记之间的class
标记。我将在几分钟内接受答复。
@using (Ajax.BeginForm(
new AjaxOptions {
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "contentlist"
})) {
<div class="input-append">
<input type="search" class="span2 search-query" name="query" />
<input type="submit" class="btn" value="Search" />
</div>
}