I have the following code inside my asp.net MVC Razor view:
<p>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.GroupID)
@Html.Partial("_CreateOrEdit", Model)
<input type="submit" value="Save" class="btn btn-primary"/>
}
@using (Html.BeginForm("Index", "SecurityGroup", FormMethod.Get))
{
<input type='submit' value='Cancel' class='btn' />
}
</p>
How I can force the two <input />
elements to be displayed beside each other, instead of being under each other?
How to display HTML <FORM> as inline element?
A
<p>
element is only allowed to contain inline elements.<form>
isn't inline, it's a block element. Try wrapping the forms in<div>
s for example:Then use the following stylesheet (either as inline style or in a CSS)
You could use a table to place the buttons next to each other:
You can also check out the bootstrap navigation bar and div tags.
Add a class to this paragraph (or ID). Make this class (ID) to be displayed inline.
jsFiddle example