I am currently facing difficulties aligning elements and displaying them in the same row. I am using MVC 5 razor pages along with HTML and Bootstrap.css. Despite spending several days on it, I have only made minimal progress since I started. I will provide any additional information required to assist me in resolving this issue – please note that there are more divisions in the table, but I have condensed the information as much as possible.
Below are the screenshots illustrating what I do not want and what I am aiming to achieve: https://i.sstatic.net/gJ2ty.png
Here is the markup code:
<table style="width: 1562px; height: 836px;" cellpadding="1"; cellspacing="0"; border="1"; >
<caption class = "control-label col-md-2", style = "display:inline; white-space:nowrap">
@Html.DisplayFor(model => model.Title)<br>
</caption>
<tbody>
<tr>
@*SECTION TITLE MODIFIED .. CATEGORY*@
<td colspan="1" rowspan="4" style="vertical-align: middle; width: 244px; margin-left:4px" class="form-horizontal" >
<br>
<ul style="color: blue; list-style-type: none; list-style-image: none; list-style-position: outside; width: 260px;" class="form-horizontal">
<li>
@Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2", style = "display:inline; white-space:nowrap" })
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
</li>
<li>
@Html.LabelFor(model => model.PublishDate, htmlAttributes: new { @class = "control-label col-md-2", style = "display:inline; white-space:nowrap" })
@Html.EditorFor(model => model.PublishDate, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.PublishDate, "", new { @class = "text-danger" })
</li>
<li style="display:inline-block; width:auto">
<div class="form-horizontal">
@Html.LabelFor(model => model.ModifiedDate, htmlAttributes: new { @class = "control-label col-md-2", style = "display:inline; white-space:nowrap" })
<div style="width:50%">
@Html.EditorFor(model => model.ModifiedDate, new { htmlAttributes = new { @class = "form-control" , style= "width:50%" } })
@Html.ValidationMessageFor(model => model.ModifiedDate, "", new { @class = "text-danger", style = "width:50%" })
</div>
</div>
</li>
<li> <p style="display:inline-block">
<div class="form-horizontal" id="isActive">
@Html.LabelFor(model => model.IsActive, htmlAttributes: new { @class = "control-label col-md-1" })
</div>
<div class="checkbox" style="align-items:flex-end;">
@Html.EditorFor(model => model.IsActive)
@Html.ValidationMessageFor(model => model.IsActive, "", new { @class = "text-danger" })
</div>
</p>
<br style="line-height:20px" />
</li>
<li> <p>
<div class="form-horizontal" id="ddlCategoryGroup" style="display:inline-block;white-space:nowrap;">
@Html.LabelFor(model => model.CategoryId, "Category", htmlAttributes: new { @class = "control-label col-md-2" })
</div>
<br style="line-height:25px;" />
<p>
<div class="col-md-10" id="ddlCategory">
@Html.DropDownList("CategoryId", null, htmlAttributes:
new { @class = "form-control", style = "font-family:'Franklin Gothic Medium', 'ArialNarrow', Arial, sans-serif; font-size:1.2EM; width:auto; display:inline; white-space:nowrap" })
@Html.ValidationMessageFor(model => model.CategoryId, "", new { @class = "text-danger" })
</div>
</p><br/>
<p style="display:inline-block">
<div>
@Ajax.ActionLink("New", "Create", "Category", Model.Category,
new AjaxOptions { UpdateTargetId = "ddlCategory", InsertionMode = InsertionMode.Replace },
new { htmlAttributes = new { @class = "control-label col-md-2" } }) |
@Ajax.ActionLink("Edit", "Edit", "Category", Model.Category,
new AjaxOptions { UpdateTargetId = "ddlCategory", InsertionMode = InsertionMode.Replace },
new { htmlAttributes = new { @class = "control-label col-md-2" } }) |
@Html.ActionLink("Delete", "Delete", new { id = @Model.CategoryId }, new { htmlAttributes = new { @class = "control-label col-md-2" } })
</div>
</p>
</p>
</li>
</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
</tbody>
</table>