c# - 内联表单无法正常工作

标签 c# css asp.net twitter-bootstrap

尝试使用 form-inline 类从 Bootstrap 中获取内联表单。但是,我遇到了一些意外行为,并且我使用的代码与 Boostrap 官方页面上列出的代码完全相同。

这是我得到的:

I dont want this

代码:

@using (Html.BeginForm("Edit", "Index", FormMethod.Post, new { @class = "form-inline" }))
{
    <div class="form-group">
        <label for="new-value">Enter new value: </label>
        <input type="text" id="new-value" class="form-control" />
    </div>
    <div class="checkbox">
        <label>
            Public: <input type="checkbox" />
        </label>
    </div>
    <input type="submit" class="btn btn-primary" />
}

当我从文本框中删除 form-control 类时,我得到了想要的结果,但那时我没有很酷的文本框:

I wanna be cool

我知道来自 Bootstrap 的警告:

This only applies to forms within viewports that are at least 768px wide.

但这是在大屏幕上,表单宽度为 1160px。

最佳答案

我已经编辑了你的代码。 希望这就是您想要的!

HTML

<form class="form-inline">
  <div class="form-group">
    <label for="new-value">Enter new value: </label>
    <input type="text" id="new-value" class="form-control" />
  </div>
  <div class="form-group">
    <div class="checkbox">
      <label> Public:
        <input type="checkbox" />
      </label>
    </div>
  </div>
  <div class="form-group">
    <input type="submit" class="btn btn-primary" />
  </div>
</form>

检查工作模型 http://www.bootply.com/ZWGwdEcnva

关于c# - 内联表单无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35180216/

相关文章:

asp.net - ASP.NET 是否将所有程序集从 bin 加载到 AppDomain 中?

不使用表单的 jQuery 验证器插件

c# - 使用 Web 应用程序调用 SSIS 包

javascript - jQuery SlideUp() 和 SlideDown() 函数在奇怪的时间触发

html - 页脚无法在 html 中正确显示

javascript - 使用 Javascript(可能使用 Canvas )获取背景图像的 urldata

c# - URL 重写不起作用

c# - 将 Entity Framework 6 与 Azure SQL 结合使用时,异步 LINQ 查询为空?

c# - 负数的平方根

c# - 如何在另一个项目中分离 Entity Framework