I have built a form in HTML 5 that is in a modal window and wrapped in Bootstrap and the layout is perfect. I have the need to use another modal window, however instead of the form being built in HTML 5 I need to place and iframe in the modal and display and asp form. I have wrapped everything identically in Bootstrap, but for some reason the label next to my form control displays on top and not next to. I'm stumped, I have played with CSS for two days now trying to figure out why. Thoughts?
HTML CODE FOR FORM THAT LAYS OUT PERFECT
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content" style="width:100%">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Observation Form</h4>
</div>
<div class="modal-body">
<form class="well form-horizontal" action=javascript:createNewObservation() method="post" id="observationForm">
<fieldset>
<!-- Form Name -->
<!-- Enter Building -->
<div class="form-group">
<label class="col-md-3 control-label">Building</label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
<select id="formBuilding" name="formBuilding" class="form-control selectpicker" required></select>
</div>
</div>
</div>
IMAGE FOR PERFECT LAYOUT
ASP CODE WRAPPED IN IFRAME THAT IS DISPLAYING IN MODAL
<form id="form1" runat="server" class="well form-horizontal">
<fieldset>
<legend>File Upload Form</legend>
<div class="form-group">
<label class="col-md-3 control-label">Choose File</label>
<div class="col-md-8 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
<asp:FileUpload class="form-control" ID="FileUpload1" runat="server" style="width:50%" />
</div>
</div>
</div>
<asp:HiddenField ID="site" runat="server" />
<asp:HiddenField ID="dateobserved" runat="server" />
<asp:HiddenField ID="guid" runat="server" />
<asp:HiddenField ID="username" runat="server" />
<asp:Button class="btn btn-primary pull-right" ID="Button1" runat="server" OnClick="Button1_Click" Text="Upload" />
</fieldset>
</form>
IMAGE FOR INCORRECT LAYOUT
To me it seems like you need to set a width to the iframe 'cause the modal size isn't changing. Try set width to 100% for the iframe
I have the below form that uses Bootstrap.
Everything seems to be working fine, until some of the fields have validation errors. When that happens, I make the feedback DIVs visible, which shifts the grid alignment.
I'm not sure what's causing this as my column sizes add up to under 12 per form-row, so they shouldn't be shifting to the next row. Any ideas would be great.
Thanks in advance.
Normal Layout
Shifted Layout (when there are validation errors)
Markup
<div class="account-options account-options-banking-details row" id="divBankingDetails" runat="server">
<hr />
<h1>Banking Details</h1>
<div class="account-options-banking-controls col-xs-10">
<div class="form-row">
<div class="form-group col-xs-5">
<label for="txtBankName">Bank Name</label>
<input type="text" class="form-control inputfield" id="txtBankName" runat="server">
<div class="invalid-feedback" id="divBankNameFeedback" runat="server" visible="false">
Required
</div>
</div>
<div class="form-group col-xs-5">
<label for="txtAccountType">Account Type</label>
<select class="form-control inputfield custom-select" ID="cboAccountType" runat="server">
<option Value="0">Choose...</option>
<option Value="1">Checking</option>
<option Value="2">Savings</option>
</select>
<div class="invalid-feedback" id="divAccountTypeFeedback" runat="server" visible="false">
Required
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-xs-5">
<label for="txtBankAccountNumber">Bank Account Number</label>
<input class="form-control inputfield acct-number" name="BankAccountNumber" id="txtBankAccountNumber" runat="server">
<span toggle=".acct-number" class="fa fa-fw fa-eye field-icon toggle-account-number"></span>
<div class="invalid-feedback" id="divBankAccountNumberFeedback" runat="server" visible="false">
Required
</div>
</div>
<div class="form-group col-xs-5">
<label for="txtReenterBankAccountNumber">Re-enter Bank Account Number</label>
<input type="text" class="form-control inputfield" id="txtReenterBankAccountNumber" runat="server">
<div class="invalid-feedback" id="divReenterBankAccountNumberFeedback" runat="server" visible="false">
Required
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-xs-5">
<label for="txtRoutingNumber">Routing Number</label>
<input type="text" class="form-control inputfield" id="txtRoutingNumber" runat="server">
<div class="invalid-feedback" id="divRoutingNumberFeedback" runat="server" visible="false">
Required
</div>
</div>
</div>
</div>
</div>
You should use .row instead of .form-row. .form-row is for Bootstrap 4
I am using Angular js, in which i have the below control.
<body class="ng-cloak">
<div ng-controller="testController" ng-init="init()">
<form name="mainForm" id="createForm" ng-submit="mainForm.$valid && add()" novalidate="">
<div class="container form-horizontal" ng-show="createMenu">
<br />
<div class="form-group">
<label for="firstName" class="col-sm-3 control-label">Name<em style="color:red">*</em></label>
<div class="col-sm-4">
<input type="text" maxlength="150" class="form-control" required="" ng-model="nName" id="nName" name="nName" />
</div>
<div class="col-sm-3">
<span class="error" ng-show="submitted == true && mainForm.nName.$error.required">Please enter Name.</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Recipient Group:<em style="color:red">*</em></label>
<div class="input-group col-sm-4" style="padding-left:10px;">
<span class="input-group-addon">
<i class="glyphicon glyphicon-search"></i>
</span>
<input type="text" class="form-control" required="" placeholder="Search the group" ng-model="searchDatalocation" ng-change="searchgroups()" name="searchValue">
</div>
<div class="col-sm-3">
<span class="error" ng-show="submitted == true && mainForm.searchValue.$error.required">Please select a Recipient group.</span>
</div>
</div>
</form>
</div>
</body>
The error message "Please enter Name" appears on right side of the textbox, however, the error message "Please select a Recipient group" appers below the control. I have tried changing the css, but it has not worked. How to set the error message to be shown on right side after the control.
Thanks
Style the .input-group div with display: inline-table; and float:left;
Please also note that there is one missing closing tag </div> for class="container form-horizontal"
I need to create a report using Report viewer. unfortunately, I haven't worked on Report viewer before. My SQL query accepts 3 parameters to fetch the data from SQL server. Query would be:
Select col1,col2,col3 from table1 where area='ddlselectedarea' and start_date='01-01-2016' and end_date='31-01-2016'
My UI would be:
<section id="content" class="has-btn-bar-btm-fixed"><!-- content -->
<form runat="server" class="form-horizontal custom-form row">
<div class="cost-transfer-block"><!-- cost-transfer-block -->
<div class="container-fluid">
<div class="row">
<div class="col-md-8 col-lg-10">
<h2>Dump by item</h2>
<div class="col-md-6">
<div class="form-group">
<asp:label runat="server" Text="From Site" ID="lblFromSite" class="control-label col-sm-3 col-md-3 col-lg-3" ></asp:label>
<div class="col-sm-9">
<div class="input-group">
<select class="form-control">
<asp:DropDownList ID="DdlFromsite" runat="server" ></asp:DropDownList>
</select>
<span class="input-group-addon"> </span>
</div>
</div>
</div>
</div>
<div class="col-md-6 cst-brd-left">
<div class="form-group">
<asp:label runat="server" Text="From Date" ID="lblFromDate" class="control-label col-sm-3 col-md-3 col-lg-3" ></asp:label>
<div class="col-sm-9 transferdate">
<div class="input-group date">
<input type="date" class="form-control" id="" placeholder="Select Date" >
<span class="input-group-addon"><img src="images/icon-add-on-2-date.png" alt="" /></span>
</div>
</div>
</div>
<div class="form-group">
<asp:label runat="server" Text="To Date" ID="lblToDate" class="control-label col-sm-3 col-md-3 col-lg-3" >To Date</asp:label>
<div class="col-sm-9 transferdate">
<div class="input-group date">
<input type="date" class="form-control" id="" placeholder="Select Date" >
<span class="input-group-addon"><img src="images/icon-add-on-2-date.png" alt="" /></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4 col-lg-2">
</div>
</div>
</div>
</div>
<!-- /cost-transfer-block -->
<%--<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>--%>
<div class="gray-btn-row clearfix">
<div class="btns-group">
<asp:button runat="server" Text="Enter" ID="btnEnter" class="btn btn-dark-blue"></asp:button>
</div>
</div>
</form>
</section>
Please guide me in designing a report using the reportviewer
The report viewer is a totally new component which needed to be designed using Report viewer or report viewer wizard. You can add any of them from the Add new items pane and bind a data table to that component.
I hope this helps others
I have some spans on my page that have value attributes.
When i try to get these attributes from the code behind, i only get the first two - the rest are null, even if the the value attributes exist and are not empty.
Howcome? This is my markup:
<div class="ExtraContainer">
<div class="box_slider">
<form id="Form1" runat="server">
<div class="block block1">
<h3>
Vælg områder</h3>
<div class="wraper">
<input id="chkAllAreas" type="radio" name="group1" class="input_radio" runat="server"/>
<label for="chkAllAreas">
Vis alle områder</label>
</div>
<div class="wraper">
<input id="chkCustomAreas" type="radio" name="group1" class="input_radio" runat="server"/>
<label for="chkCustomAreas">
Vælg områder</label>
</div>
</div>
<div class="block block2">
<h3>
Vælg Ledighed</h3>
<div class="wraper">
<input id="chkShowAll" type="radio" name="group2" class="input_radio" runat="server" />
<label for="chkShowAll">
Vis alle boliger</label>
</div>
<div class="wraper">
<input id="chkIsAvailable" type="radio" name="group2" class="input_radio" runat="server" />
<label for="chkIsAvailable">
Vis kun ledige boliger</label>
</div>
</div>
<div class="block block3">
<h3>
Vælg boligtype</h3>
<div class="wraper go_left">
<input id="chkAllTHousingTypes" type="checkbox" class="input_check" runat="server" />
<label for="chkAllTHousingTypes">
Vis alle boligtyper</label>
</div>
<div class="wraper go_left">
<input id="chkFamilieboliger" type="checkbox" class="input_check" runat="server" />
<label for="chkFamilieboliger">
Familieboliger</label>
</div>
<div class="wraper go_left">
<input id="chkUngdomsboliger" type="checkbox" class="input_check" runat="server" />
<label for="chkUngdomsboliger">
Ungdoms- & studieboliger</label>
</div>
<div class="wraper go_left">
<input id="chkAeldrebolig" type="checkbox" class="input_check" runat="server" />
<label for="chkAeldrebolig">
Senior- & ældreboliger</label>
</div>
</div>
<div class="clear">
</div>
<div class="line">
</div>
<div class="block4 go_left">
<h3>
Vælg økonomi</h3>
<div class="slider_info">
<div class="slider_info_leftright_container">
<div class="slider_info_left">
<span>Husleje</span>
</div>
<div class="slider_info_right" style="float: right">
<span id="huslejefra" runat="server"></span> <em>til</em> <span id="huslejetil" runat="server"></span><span>kr</span>
</div>
</div>
<div class="Slider">
<div id="husleje-slider-range">
</div>
</div>
</div>
<div class="slider_info">
<div class="slider_info_leftright_container">
<div class="slider_info_left">
<span>Indskud</span>
</div>
<div class="slider_info_right" style="float: right">
<span id="indskudfra" runat="server"></span> <em>til</em> <span id="indskudtil" runat="server"></span><span>m2</span>
</div>
<div class="Slider">
<div id="indskud-slider-range">
</div>
</div>
</div>
</div>
</div>
<div class="block4 go_right">
<h3>
Vælg størrelse</h3>
<div class="slider_info">
<div class="slider_info_leftright_container">
<div class="slider_info_left">
<span>Antal værelser</span>
</div>
<div class="slider_info_right" style="float: right">
<span id="rumfra" runat="server">3</span> <em>til</em> <span id="rumtil"
runat="server">6</span><span>rum</span>
</div>
</div>
<div class="Slider">
<div id="rum-slider-range">
</div>
</div>
</div>
<div class="slider_info">
<div class="slider_info_leftright_container">
<div class="slider_info_left">
<span>m2</span>
</div>
<div class="slider_info_right" style="float: right">
<span id="storrelsefra" value="2" runat="server"></span> <em>til</em> <span id="storrelsetil" runat="server"></span><span>m2</span>
</div>
</div>
<div class="Slider">
<div id="storrelse-slider-range">
</div>
</div>
</div>
</div>
<asp:Button ID="searchButton" OnClick="ImgSearch_Click" Text="Søg" runat="server" />
</form>
<div class="clear">
</div>
</div>
<div class="block5">
<h3>
Vælg resultatvisning</h3>
<div class="buttonswrapper">
<div class="wraper">
<input id="id9" type="radio" class="input_radio" />
<label for="id9">
Billedevisning</label>
</div>
<div class="wraper">
<input id="id10" type="radio" class="input_radio" />
<label for="id10">
Kortvisning</label>
</div>
</div>
<a class="link_img resetBtn" href="#">
<img src="style/images/select_img.png" alt="" />Nulstil søgningen</a>
</div>
<div class="clear"> </div>
<input id="HDSelectedAreas" type="hidden" runat="server" class="HSelectedArea" />
</div>
the search button looks like this in the aspx:
<asp:Button ID="searchButton" OnClick="ImgSearch_Click" Text="Søg" runat="server" />
And this is the code behind:
protected void ImgSearch_Click(object sender, EventArgs e)
{
String cRoomsFrom = rumfra.Attributes["value"];
String cRoomsTo = rumtil.Attributes["value"];
String cSizeFrom = storrelsefra.Attributes["value"];
String cSizeTo = storrelsetil.Attributes["value"];
String cRentFrom = huslejefra.Attributes["value"];
String cRentTo = huslejetil.Attributes["value"];
String cDepositFrom = indskudfra.Attributes["value"];
String cDepositTo = indskudtil.Attributes["value"];
}
to initialize the values:
<script type="text/javascript" language="javascript">
function setupSlider(min, max, step, values, sliderElement, minelement, maxelement) {
$(sliderElement).slider({
range: true,
min: min,
max: max,
values: values,
step: step,
slide: function (event, ui) {
$(minelement).html(ui.values[0]);
$(maxelement).html(ui.values[1]);
$(minelement).attr('value', ui.values[0]);
$(maxelement).attr('value', ui.values[1]);
__doPostBack();
}
});
$(minelement).html($(sliderElement).slider("values", 0));
$(maxelement).html($(sliderElement).slider("values", 1));
$(minelement).attr('value', $(sliderElement).slider("values", 0));
$(maxelement).attr('value', $(sliderElement).slider("values", 1));
}
function initializeSliders()
{
// størrelse slider
var values = [10, 80];
setupSlider(10, 80, 10, values, "#storrelse-slider-range", "#storrelsefra", "#storrelsetil");
// husleje slider
values = [1000, 7000];
setupSlider(1000, 12000, 1000, values, "#husleje-slider-range", "#huslejefra", "#huslejetil");
/// rum
values = [3, 6];
setupSlider(1, 8, 1, values, "#rum-slider-range", "#rumfra", "#rumtil");
// indskud
values = [3000, 7000];
setupSlider(1000, 10000, 1000, values, "#indskud-slider-range", "#indskudfra", "#indskudtil");
//fix color
fixToolTipColor();
}
$(document).ready(function () {
$('.Udvidet').live('click', function () {
$('.UdvidetSoegning').toggle('slow');
});
$(function () {
initializeSliders();
$(".resetBtn").live("click", function () {
initializeSliders();
__doPostBack();
});
});
});
</script>
I tried changing to InnerHtml and InnerText, but the result is the same. Sometimes the value property is null, but then InnerHtml or InnerText return the actual value :S
On post back only the input elements are posted.
So they are the same as before the post back, what they have before the post back, have and now. So actually you do not "get" this parameters on code behind, you only "set" them and on server controls with viewstate on, you can remember this parametres on post back - but you can not change them on client side and expect to read this change on server.
Here the workaround is. Ether use the viewstate of the page to save some values and keep them on post back, ether use input hidden elements to have them on post back.