- Home
- Forum
- ASP.NET MVC
- Date picker renders on a separate line in Bootstrap 3 form
Date picker renders on a separate line in Bootstrap 3 form
Hi,
I would like DataPicker in the same line as other controls in the form but it is rendered in a separate line. After DatePicker, the button is also in the new line. If I leave out DataPicker, all controls in the form are in the same line.
<div class="row"> <div class="span12"> <div class="well account-search"> <form class="form-inline"> <div class="form-group"> <label for="Account">Search: </label> <input type="text" autofocus="autofocus" name="searchString" id="Account" value="@Model.PID"> <label for="datePortfolio">Portolio Date: </label> @Html.EJ().DatePicker("datePortfolio").Value(@Model.PortfolioDate).EnablePersistence(false).DateFormat(eCubeWP.Helpers.Common.SF_DATEFORMAT) <button type="button" id="loadPortfolio" class="btn btn-primary">Show Portfolio</button> </div> </form> </div> </div> </div>
SIGN IN To post a reply.
3 Replies
SA
Shameer Ali Baig Sulaiman Ali Baig
Syncfusion Team
January 15, 2018 11:26 AM UTC
Hi Bojan,
Thanks for contacting Syncfusion Support.
We have checked with your query. In EJ DatePicker, display style of the wrapper element is set as block. So, DatePicker control will render in new line and takes up the whole width. We can override the display style of the wrapper element of DatePicker control as inline-block to render it in the same line with other controls in the form. Please, check out the below sample code to render DatePicker control as per your requirement.
Solution 1:
|
[DatePicker.cshtml]
<div class="row">
<div class="span12">
<div class="well account-search">
<form class="form-inline">
<div class="form-group">
<label for="Account">Search: </label>
<input type="text" autofocus="autofocus" name="searchString" id="Account" value="">
<label for="Account">Search: </label>
<input type="text" autofocus="autofocus" name="searchString" id="Account" value="">
<label for="datePortfolio">Portolio Date: </label>
<span id="Datepicker1">
@Html.EJ().DatePicker("datePortfolio").Value("").EnablePersistence(false)
</span>
<button type="button" id="loadPortfolio" class="btn btn-primary">Show Portfolio</button>
</div>
</form>
</div>
</div>
</div>
<style>
#Datepicker1 {
display:inline-block;
position:relative;
top:10px;
}
</style> |
Solution 2:
|
[DatePicker.cshtml]
<div class="row">
<div class="span12">
<div class="well account-search">
<form class="form-inline">
<div class="form-group">
<label for="Account">Search: </label>
<input type="text" autofocus="autofocus" name="searchString" id="Account" value="">
<label for="Account">Search: </label>
<input type="text" autofocus="autofocus" name="searchString" id="Account" value="">
<label for="datePortfolio">Portolio Date: </label>
@Html.EJ().DatePicker("datePortfolio").Value("").EnablePersistence(false)
<button type="button" id="loadPortfolio" class="btn btn-primary">Show Portfolio</button>
</div>
</form>
</div>
</div>
</div>
<style>
.e-datewidget {
display:inline-block;
position:relative;
top:10px;
}
</style> |
For your convenience, we have attached a sample to meet your requirement. Please, download the sample from the below link.
Regards,
Shameer Ali Baig S.
BK
Bojan Kuhar
January 15, 2018 05:04 PM UTC
Thank you,
the solution works.
Regards
Bojan
SA
Shameer Ali Baig Sulaiman Ali Baig
Syncfusion Team
January 16, 2018 10:38 AM UTC
Hi Bojan,
Thanks for the update. We are happy to hear that the issue is resolved at your end. Please get back to us if you need any further assistance.
Regards,
Shameer Ali Baig S.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
BK Bojan Kuhar
- Jan 13, 2018 03:45 PM UTC
- Jan 16, 2018 10:38 AM UTC