gpt4 book ai didi

html - 使用 twitter bootstrap 定位表单输入

转载 作者:行者123 更新时间:2023-11-28 12:41:33 25 4
gpt4 key购买 nike

我正在尝试在表单中定位一些输入字段,但无论我尝试什么,我似乎都无法做到正确。我想让表单在页面中居中,每个输入都被标记,并且输入有两个或三个到一行到一个点。无论我尝试什么,一切要么偏离中心,要么似乎什么也没做。任何帮助表示赞赏。我的代码如下:

@using (Html.BeginForm("SaveNew", "MaintainProjects", FormMethod.Post))
{
@Html.ValidationSummary();
<input type="submit" value="Save" />
@Html.Hidden("PriorityCode", "0000")
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Name")
@Html.TextBox("Name")
@Html.Label("Status")
@Html.TextBox("Status")

</div>
</div>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("WatchList")
@Html.CheckBox("WatchList")
</div>
</div>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Goal")
@Html.DropDownListFor(m => m.GoalID, new SelectList(Model.GoalID, "GoalID", "Goal"))
@Html.Label("Level")
<select name="LevelID">
<option value="1">Non-TSC</option>
<option value="2">TSC</option>
</select>
</div>
</div>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Indicator")
@Html.DropDownListFor(m => m.IndicatorID, new SelectList(Model.IndicatorID, "IndicatorID", "ProjectIndicator"))
@Html.Label("Business")
@Html.DropDownListFor(m => m.LOBID, new SelectList(Model.LOBID, "LOBId", "LOB", Model.LOBID[0].LOBId))
@Html.Label("Department")
@Html.DropDownListFor(m => m.DepartmentID, new SelectList(Model.DepartmentID, "DepartmentId", "DepartmentName"))
</div>
</div>
<p>Project Description</p>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Business Issue")
@Html.TextArea("BusinessIssue", new { @rows = "3" })
</div>
</div>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Solution")
@Html.TextArea("Solution", new { @rows = "3" })
</div>
</div>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Benefits")
@Html.TextArea("Benefits", new { @rows = "3" })
</div>
</div>
<div class ="control-group">
<div class ="controls form-inline">
@Html.Label("Project Directory")
@Html.TextBox("ProjectDirectory")
</div>
</div>
}

最佳答案

不清楚您想要实现什么。模型的屏幕截图会很棒。看来您不应该到处都放置“表单内联”类。例如,通常此类不会放在 contol-group 元素上。虽然代码很乱,但我并没有仔细看。查看TwitterBootstrapMvc .它会让你的代码更干净。你将能够用它写这样的东西:

@using (Html.Bootstrap().Begin(new Form().Type(FormType.Horizontal)))
{
@Html.Bootstrap().ValidationSummary()

@Html.Bootstrap().ControlGroup().CheckBox("WatchList")
@Html.Bootstrap().ControlGroup().DropDownListFor(m => m.LOBID, new SelectList(Model.LOBID, "LOBId", "LOB", Model.LOBID[0].LOBId))
@Html.Bootstrap().ControlGroup().TextArea("BusinessIssue")
}

我没有写下你所有的输入,但你明白了。

关于html - 使用 twitter bootstrap 定位表单输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17643564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com