ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
AjaxCheckboxList Multiselect using bootstrap form-control does not display properly
Title:
B
I
{code}
?
Here is my code for the ajaxdropdownlist: <div class="col-md-2" id="testName"> Test Names: @(Html.Awe().AjaxCheckboxList("TestNames").Multiselect(o => o.NoSelectClose()).Url(Url.Action("GetTestNames", "GetData")).CssClass("form-control")) </div> The problem is the input field and form are separate and the input field is stacked on top of the form. They dont have the same dimension. The figure out the problem is because I use boostrap css class form-control. If I remove the class, it works just like the demo. But I have been using this class for entire view and I want to keep the look consistent. How can I still use the class form-control and the UI still looks good? I wish I can upload an image here capturing the issue. If you are not clear, just apply the class on AjaxCheckboxlist and you can see the issue.Thanks
Save Changes
Cancel
CuLacGionTan
asked at 10 Nov 2015
form-control is intended to be used for input textarea and select http://getbootstrap.com/css/#forms-example, basically native html editors, in your case it's added to the most outer div of a complex component, it adds a fixed height to the div so it makes it look wrong you could still use it, but you need to add another class that will override set height, padding and border, try this: .awe-field.form-control { padding: 0; height: auto; border: none; }
at 11 Nov 2015
Omu
Thank you, it works now. Btw, how can I overwrite the text on the checkboxlist which is "please select". I use the checkboxlist in multiple places and I want a unique text for each place, possibly apply different style to the text? My second question is: return Json(testNames.Select(o => new KeyContent(o.TestrequestId, o.TestName))); On this code I pass testrequestId on purpose of using it as Id for the list. But I inspect the list, it only has data-index values (start from 0-> n) which are not associated with the testrequestIds. How can I pass testrequestIds of selected items to controller?
at 11 Nov 2015
CuLacGionTan
inside the .Multiselect(o => ... .Caption("not selected")
at 11 Nov 2015
Omu
Thanks, I figured out how to get the ids. How can I apply validation on this AjaxCheckboxlist? Do I have to use AjaxCheckboxlistFor?
at 12 Nov 2015
CuLacGionTan
same as you would do for anything else, have a look at the source for this demo: http://demo.aspnetawesome.com/Unobtrusive
at 12 Nov 2015
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK