We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DatePicker in inline-form from Bootstrap

Thread ID:

Created:

Updated:

Platform:

Replies:

147519 Sep 13,2019 03:13 PM UTC Sep 17,2019 10:00 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: DatePicker
Kabanets
Asked On September 13, 2019 03:13 PM UTC

Hello,

I have a form with using bootstrap style inline-form.
I want insert a DatePicker with a Label to form-group.

```
<div class="form-group">
    @Html.LabelFor(model => model.DateFrom, htmlAttributes: new { @class = "control-label" })
    @Html.EJS().DatePickerFor(model => model.DateFrom).Render()
</div>
```
How can I use class form-control from bootstrap for the DatePicker to get behavior inline-form?
I have this problem with another controls from EJS...

Thank you,
Regards, Andrew

Ashokkumar Balasubramanian [Syncfusion]
Replied On September 16, 2019 11:04 AM UTC

Hi Kabanets, 
 
Good day to you. 
 
Our Syncfusion form controls are rendered with “display:flex and width as 100%” as an inbuilt style. So, it will be rendered with one by one as a block component. So, we suggest you provide width as auto for the form component by using cssClass as mentioned in the below code example to achieve your requirement. 
 
<form class="form-inline"> 
    @Html.LabelFor(model => model.DateFrom, htmlAttributes: new { @class = "control-label" }) 
    @* cssClass will be added to the wrapper element of the component *@ 
    @Html.EJS().DatePickerFor(model => model.DateFrom).CssClass("e-inlineForm").Render() 
 
    @Html.LabelFor(model => model.DateFrom, htmlAttributes: new { @class = "control-label" }) 
    @Html.EJS().NumericTextBox("sdhg").CssClass("e-inlineForm").Render() 
 
</form> 
<style> 
    .form-inline .e-inlineForm { 
        width: auto !important; 
    } 
</style> 
 
Sample:  
 
 
Could you please check the above sample and get back to us, if you require any further assistance on this? 
 
Regards, 
Ashokkumar B. 


Kabanets
Replied On September 16, 2019 02:32 PM UTC

Hi, Ashokkumar Balasubramanian
Thank you for answer.

How can I get behaviour the label as with standard bootstrap form-controls for small displays?

Regard, Kabanets

Attachment: Screenshot_20190916_at_17.26.47_1e0ff7f0.zip

Ashokkumar Balasubramanian [Syncfusion]
Replied On September 17, 2019 10:00 AM UTC

Hi Kabanets 
 
For this scenario, you can define the width as 100% to achieve the behavior of label as standard bootstrap form-controls in the small display. Please refer the below code block. 
 
<form class="form-inline"> 
    <div class="form-group"> 
        @Html.LabelFor(model => model.DateFrom, htmlAttributes: new { @class = "control-label" }) 
        @* cssClass will be added to the wrapper element of the component *@ 
        @Html.EJS().DatePickerFor(model => model.DateFrom).CssClass("e-inlineForm").Render() 
    </div> 
    <div class="form-group"> 
        @Html.LabelFor(model => model.DateFrom, htmlAttributes: new { @class = "control-label" }) 
        @Html.EJS().NumericTextBox("numeric").CssClass("e-inlineForm").Render() 
    </div> 
</form> 
<style> 
    .form-inline .e-inlineForm { 
        width: auto !important; 
    } 
 
    @@media only screen and (max-width : 400px) { /* You can provide the max-width as per your display resolution*/ 
        .form-inline .e-inlineForm { 
            width: 100% !important; 
        } 
    } 
</style> 
 
Please let us know, if you require any further assistance on this. 
 
Regards, 
Ashokkumar B. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon