I'm trying to center a bunch of control within a fieldset and 2 of them are <asp:FileUpload /> .One is behaving as intended but not the other :
I've created my fieldset within a <div id="container"> and inside the fieldset you have a <div class="content"> which contains the Labels, FileUpload etc.
The aspx file is as follow :
<div id="container">
<fieldset>
<legend style="color:#CC0000; font-size:medium; font-weight:bold">Nouvelle demande de tarif imagé</legend>
<br />
<div class="content">
<asp:Label ID="Label2" runat="server" Text="Nom du catalogue : "
Font-Bold="True"></asp:Label>
<asp:TextBox ID="TB_name" runat="server"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator2" runat="server"
ErrorMessage="CustomValidator" ControlToValidate="TB_name" ForeColor="#CC0000"
onservervalidate="CustomValidator2_ServerValidate" ValidateEmptyText="True"></asp:CustomValidator>
<br />
<br />
<asp:Label ID="Label3" runat="server"
Text="Veuillez sélectionner un fichier CSV :" Font-Bold="True"></asp:Label><br />
<br />
<asp:FileUpload ID="csvUpload" runat="server" />
<asp:CustomValidator ID="CustomValidator1" runat="server"
ErrorMessage="CustomValidator" ControlToValidate="csvUpload"
Display="Dynamic" ForeColor="#CC0000"
onservervalidate="CustomValidator1_ServerValidate"
ValidateEmptyText="True"></asp:CustomValidator>
<br />
<br />
<br />
<asp:Label ID="Label1" runat="server"
Text="Veuillez sélectionner un logo (facultatif) :" Font-Bold="True"></asp:Label><br />
<br />
<asp:FileUpload ID="pictureUpload" runat="server" />
<asp:CustomValidator ID="CustomValidator3" runat="server"
ErrorMessage="CustomValidator" ControlToValidate="pictureUpload"
ForeColor="#CC0000" onservervalidate="CustomValidator3_ServerValidate"
ValidateEmptyText="True"></asp:CustomValidator>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Valider"
onclick="Button1_Click" />
<br />
<br />
<asp:HyperLink ID="HyperLink_validee" runat="server" Font-Underline="True"
ForeColor="#009933" NavigateUrl="~/TarifImageHistorique.aspx">Votre demande a bien été enregistrée</asp:HyperLink>
<br />
</div>
</fieldset>
</div>
and here is the CSS :
fieldset
{
margin-bottom:20px;
border:1px solid rgb(149,149,149);
padding: 10px 10px 10px 10px;
width:100%;
}
#container
{
margin-left:auto;
margin-right:auto;
width:400px;
}
.content
{
text-align:center;
}
I don't get why the second FileUpload won't align as the first one. Can anyone enlighten me ?
Your CustomValidator3 in front of second file upload control needs dynamic displaying so just add Display="Dynamic" and done.
You have to put your second file upload control in <center> tag.
Below code around line 31
... // your code
<center>
<asp:FileUpload ID="pictureUpload" runat="server" />
</center>
... // your code
Related
I have a created a profile page for my website, there is a photo, upload button and a fileUpload control. Controls such as First name/ last name etc are placed In a panel separate from image and image control. The problem is that Panel leaves a huge margin from top (I haven't given margin-top). I want to remove that white space. I have tried a couple of things such as providing position (absolute/relative) and I tried to rearrange the controls but didn't work
.common
{
float: left;
position: relative;
}
.Panel
{
margin-right: 50px;
padding: 20px;
float: right;
}
.layWork
{
border: white 2px solid;
width: 800px;
background-color: white;
border-radius: 50px;
height: 700px;
margin: 50px 0px 20px 50px;
}
<div class="layWork">
<div class="Frontier">
<br />
<br />
<asp:Image ID="Shasshin" runat="server" src="../Property/EmptyIcon.png" Height="200px" Width="200px" cssClass="common"/>
<br />
<asp:Panel ID="proPan" runat="server" CssClass="Panel">
<asp:Label ID="proFNameLabel" Text="First Name : " runat="server" />
<asp:TextBox ID="proFNameBox" runat="server" Text=""/>
<br /><br />
<asp:Label ID="proLNameLabel" Text="Last Name : " runat="server" />
<asp:TextBox ID="proLNameBox" runat="server" Text="" />
<br /><br />
<asp:Label ID="proAge" Text="Age : " runat="server" />
<asp:TextBox ID="proAgeBox" runat="server" />
<br /><br />
<asp:Label ID="proBirth" Text="Birthdate : " runat="server"/>
<asp:TextBox ID="proBirthBox" runat="server"/>
<br /><br />
<asp:Label ID="proLoc" Text="Localtion : " runat="server" />
<asp:TextBox ID="proLocBox" runat="server" />
<br /><br />
<asp:Label ID="proNumber" Text="Phone : " runat="server" />
<asp:TextBox ID="proNumBox" runat="server" />
<br /><br />
<asp:Label ID="SkypeID" Text="Skype ID : " runat="server" />
<asp:LinkButton ID="proSkype" runat="server">Link</asp:LinkButton>
<br /><br />
<asp:Label ID="proDesc" Text="Description : " runat="server" />
<asp:TextBox ID="proDescBox" TextMode="MultiLine" runat="server" />
<br /><br />
<asp:Label ID="proDev" Text="Developer : " runat="server" />
<asp:TextBox ID="proDevBox" runat="server" />
</asp:Panel>
<asp:FileUpload ID="PhotoPicker" CssClass="common" runat="server" /><br />
<asp:Button ID="PhotoSender" runat="server" cssClass="common" Text="Upload" />
</div>
</div>
I use table generally ,so this may help.
<table>
<tr>
<td style="vertical-align:top"> <asp:Image ID="Shasshin" runat="server" src="../Property/EmptyIcon.png" Height="200px" Width="200px" cssClass="common"/></td>
<td> </td>
<td style="vertical-align:top"> <asp:Panel ID="proPan" runat="server" CssClass="Panel">
<asp:Label ID="proFNameLabel" Text="First Name : " runat="server" />
<asp:TextBox ID="proFNameBox" runat="server" Text=""/>
<br /><br />
<asp:Label ID="proLNameLabel" Text="Last Name : " runat="server" />
<asp:TextBox ID="proLNameBox" runat="server" Text="" />
<br /><br />
<asp:Label ID="proAge" Text="Age : " runat="server" />
<asp:TextBox ID="proAgeBox" runat="server" />
<br /><br />
<asp:Label ID="proBirth" Text="Birthdate : " runat="server"/>
<asp:TextBox ID="proBirthBox" runat="server"/>
<br /><br />
<asp:Label ID="proLoc" Text="Localtion : " runat="server" />
<asp:TextBox ID="proLocBox" runat="server" />
<br /><br />
<asp:Label ID="proNumber" Text="Phone : " runat="server" />
<asp:TextBox ID="proNumBox" runat="server" />
<br /><br />
<asp:Label ID="SkypeID" Text="Skype ID : " runat="server" />
<asp:LinkButton ID="proSkype" runat="server">Link</asp:LinkButton>
<br /><br />
<asp:Label ID="proDesc" Text="Description : " runat="server" />
<asp:TextBox ID="proDescBox" TextMode="MultiLine" runat="server" />
<br /><br />
<asp:Label ID="proDev" Text="Developer : " runat="server" />
<asp:TextBox ID="proDevBox" runat="server" />
</asp:Panel></td>
</tr>
<tr>
<td> <asp:FileUpload ID="PhotoPicker" CssClass="common" runat="server" /></td>
<td> <asp:Button ID="PhotoSender" runat="server" cssClass="common" Text="Upload" /> </td>
</tr>
</table>
I've created a user control that has one asp:Image and one asp:Label below it and one more asp:Label below last label. I want this user control behaves like a button entirely, mean that we have a box that image and two labels are in it and when user click on every point on this box, it acts like a button and do anything according to it's click event.
can anyone please help me?
<%# Control Language="VB" AutoEventWireup="false" CodeFile="room.ascx.vb" Inherits="room" %>
<style type="text/css">
.image {
width:100px;
height:100px;
margin:2px;
border:solid;
border-width:1px;
}
.text {
margin-left:2px;
margin-right:2px;
text-wrap:normal;
text-align:right
}
</style>
<asp:Panel ID="Panel" runat="server" width="106px" BorderStyle="Solid" BorderWidth="3px" BackColor="Wheat">
<asp:Image ID="img" runat="server" CssClass="image" /> <br />
<asp:Label ID="name" runat="server" Text="name" Width="100px" CssClass="text" /> <br />
<asp:Label ID="price" runat="server" Text="Label" Width="100px" CssClass="text" /> <br />
</asp:Panel>
try adding onclick="yourFunction()" in asp:Panel so it will look like this
<asp:Panel ID="Panel" runat="server" onClick="yourJsFunction()" width="106px" BorderStyle="Solid" BorderWidth="3px" BackColor="Wheat">
<asp:Image ID="img" runat="server" CssClass="image" /> <br />
<asp:Label ID="name" runat="server" Text="name" Width="100px" CssClass="text" /> <br />
<asp:Label ID="price" runat="server" Text="Label" Width="100px" CssClass="text" /> <br />
</asp:Panel>
you can also check other questions on stackoverflow. Some already answered question can be found at following links
add mouseclick event to panel
Adding OnClick event to ASP.NET control
I have a problem with my footer as I divided the page as follow:
<%# Page Title="" Language="C#" MasterPageFile="~/SVM.Master" AutoEventWireup="true" CodeBehind="Cateshow.aspx.cs" Inherits="beravoSV.Cateshow" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
.style8 {
color: #333333;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="midcont">
<div class="leftsidemainadsshow">
<br />
<asp:ListView ID="cateshowlistview" runat="server" DataSourceID="categoryshowsql" Style="text-align: left">
<ItemTemplate>
<div class="templist">
<asp:LinkButton ID="Adstitlinkbtn" runat="server"
Style="font-weight: 700; color: #0066FF" Text='<%# Eval("AdsTit") %>'
CssClass="adstit" OnClick="Adstitlinkbtn_Click"
PostBackUrl='<%# "AdsDetails.aspx?AdsTit=" + Eval("AdsID") %>'></asp:LinkButton>
<br />
<asp:ImageButton ID="ImageButton3" runat="server" Height="88px" Width="91px"
CssClass="imag1" ImageUrl='<%# "/images/AdsImgs/" + Eval("Img1") %>'
PostBackUrl='<%# "AdsDetails.aspx?Img1=" + Eval("AdsID") %>' />
<br />
<asp:Label ID="AdsDescLabel" runat="server" Text='<%# Eval("AdsDesc") %>'
CssClass="adsdisc" />
<br />
<br />
<br />
<br />
<asp:Label ID="Sectlbl" runat="server" Text='<%# Eval("Section") %>'
Style="color: #333333"></asp:Label>
-
<asp:Label ID="categlbl" runat="server" Text='<%# Eval("Category") %>'
Style="color: #333333; font-weight: 700; font-style: italic;"></asp:Label>
<br />
<asp:Label ID="CountryLabel" runat="server" Text='<%# Eval("Country") %>'
Style="color: #333333" />
-
<asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>'
Style="color: #333333" />
-
<asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>'
Style="color: #333333" />
<div class="adsprice">
<span class="style8">Price:</span>
<asp:Label ID="AdsPriceLabel" runat="server" Style="color: #FF0000"
Text='<%# Eval("AdsPrice") %>' />
</div>
<div class="iconadsbox">
<asp:ImageButton ID="Likebtn" runat="server"
ImageUrl="~/iconsimg/favoritestar2.png" OnClick="Likebtn_Click" />
<asp:ImageButton ID="sendmailbtn" runat="server"
ImageUrl="~/iconsimg/mailposter.png" OnClick="sendmailbtn_Click" />
</div>
<asp:Image ID="Image1" runat="server" CssClass="divideline" />
<br />
</div>
</ItemTemplate>
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
<asp:DataPager ID="DataPager2" runat="server" PagedControlID="cateshowlistview" PageSize="7">
<Fields>
<asp:NumericPagerField />
<asp:NextPreviousPagerField />
</Fields>
</asp:DataPager>
</LayoutTemplate>
</asp:ListView>
</div>
<div class="primumads">
</div>
<br />
<br />
<asp:SqlDataSource ID="categoryshowsql" runat="server"
ConnectionString="<%$ ConnectionStrings:BeravaConnectionString %>"
SelectCommand="SELECT DISTINCT [AdsID],[Section], [Category], [Country], [State], [City], [AdsTit], SUBSTRING([AdsDesc],1,155) as AdsDesc, [AdsPrice], [Img1] FROM [ads] WHERE (([Category] = #Category) AND ([Country] = #Country))">
<SelectParameters>
<asp:QueryStringParameter Name="Category" QueryStringField="cat"
Type="String" />
<asp:SessionParameter Name="Country" SessionField="location" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</div>
<br />
</asp:Content>
When the rightside is empty the footer is going up and if it is full its will come down to the bottom. How I can make it always down even if the right side is empty?
You can find the below link to know more what is going up with me
enter link description here
You can add to te footer the following:
style="position: fixed; bottom: 0; width: 100% (This will fix the footer to the bottom of your screen)
If what is to fix the footer to the end of you page, you need to give to the header and to the content of your page a min height, here's an example:
<div id="header" style="min-height: 10%"></div>
<div id="content" style="min-height: 80%"></div>
<div id="footer" style="min-height: 10%"></div>
Note: you don't need to say that min-height: 10% in the footer, that's implicit.
How can I show / hide certain divs according to the selected value in the dropdownlist:
(for example, if Convert from Fahrenheit to Celsius is currently selected in the dropdown, only the conversion div is visible)
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p>
Please choose required calculation from the following list:
<asp:DropDownList ID="calculation" runat="server">
<asp:ListItem>Addition of three numbers</asp:ListItem>
<asp:ListItem>Convert from Fahrenheit to Celsius</asp:ListItem>
<asp:ListItem>Calculate the side of a right-angled triangle</asp:ListItem>
<asp:ListItem>Find x using the Quadratic Equation</asp:ListItem>
</asp:DropDownList>
<br /><br />
</p>
<div id="addition" runat="server">
<p>
Input variable a : <asp:TextBox runat="server" ID="varA"></asp:TextBox><br /><br />
Input variable c : <asp:TextBox runat="server" ID="varB"></asp:TextBox><br /><br />
Input variable b : <asp:TextBox runat="server" ID="varC"></asp:TextBox><br /><br />
<asp:Button ID="additionSubmit" runat="server" Text="Submit"
onclick="additionSubmit_Click" /><br /><br />
<asp:Label ID="lblAddition" runat="server" Text="" CssClass="label"></asp:Label>
</p>
</div>
<div id="conversion" runat="server">
<p>
Input Fahrenheit Temperature : <asp:TextBox runat="server" ID="temperatureF"></asp:TextBox><br /><br />
<asp:Button ID="converstionSubmit" runat="server" Text="Submit"
onclick="converstionSubmit_Click" /><br /><br />
<asp:Label ID="lblConversion" runat="server" Text="" CssClass="label"></asp:Label>
</p>
</div>
<div id="triangle" runat="server">
<p>
Input side a : <asp:TextBox runat="server" ID="tsideA"></asp:TextBox><br /><br />
Input side b : <asp:TextBox runat="server" ID="tsideB"></asp:TextBox><br /><br />
<asp:Button ID="triangleSubmit" runat="server" Text="Submit"
onclick="triangleSubmit_Click" /><br /><br />
<asp:Label ID="lblTriangle" runat="server" Text="" CssClass="label"></asp:Label>
</p>
</div>
<div id="quadratic" runat="server">
<p>
Input side a : <asp:TextBox runat="server" ID="sideA"></asp:TextBox><br /><br />
Input side c : <asp:TextBox runat="server" ID="sideB"></asp:TextBox><br /><br />
Input side b : <asp:TextBox runat="server" ID="sideC"></asp:TextBox><br /><br />
<asp:Button ID="quadraticSubmit" runat="server" Text="Submit"
onclick="quadraticSubmit_Click" /><br /><br />
<asp:Label ID="lblQuadratic" runat="server" Text="" CssClass="label"></asp:Label>
</p>
</div>
Using Jquery this would work:
(document).ready(function() {
doIt();
$('#yourDropdown').change(doIt); //This is triggered on the change of the dropdown list
function doIt() {
switch ($("#yourDropdown").val()) {
case "addition" :
$("#addition").show();
$('#otherDiv').hide();
break;
case "ConvertFToC":
and so on....
}
});
})
<select id="yourDropdown">
<option value="addition">addition</option>
and so on...
</select>
<div id="addition" >
<p>
Input variable a : <asp:TextBox runat="server" ID="varA"></asp:TextBox><br /><br />
Input variable c : <asp:TextBox runat="server" ID="varB"></asp:TextBox><br /><br />
Input variable b : <asp:TextBox runat="server" ID="varC"></asp:TextBox><br /><br />
<asp:Button ID="additionSubmit" runat="server" Text="Submit"
onclick="additionSubmit_Click" /><br /><br />
<asp:Label ID="lblAddition" runat="server" Text="" CssClass="label"></asp:Label>
</p>
</div>
They all appear left aligned. I've tried setting the body tag to text-align:center, making divs around and in the main panel, but I can't get it to work. Any ideas?
Here is my CSS code:
.MainPanel {
background-color:#ccccff;
margin-bottom:10px;
margin-top:10px;
}
.MainPanel div {
margin-bottom:10px;
margin-top:10px;
}
.panelSpace {
margin-bottom:25px;
margin-top:25px;
}
.buttonWidth { clear: both; }
.buttonWidth div {
width:17%;
float:left;
margin-left:20px;
}
.centerDiv {
width:100%;
text-align:center;
}
And here's my html:
<body>
<form id="form1" runat="server">
<div style="height:100px; text-align:center;"><uc1:Header ID="Header1" runat="server" /></div><br /><br />
<div>
<div><asp:Label runat="server" ID="lblErrorMessage" CssClass="lblErrorMessage" /></div>
<asp:Panel ID="Panel0" runat="server" BackColor="#9999CC" BorderColor="DarkBlue" BorderWidth="2px">
<div class="centerDiv">
<div>
<asp:Panel ID="Panel1" runat="server" CssClass="MainPanel" Width="550" BorderColor="DarkBlue" BorderWidth="2px" >
<div>Customer: <asp:DropDownList ID="ddlCustomerList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCustomerList_SelectedIndexChanged" /></div>
</asp:Panel>
</div>
<span class="panelSpace" />
<asp:Panel ID="Panel2" runat="server" CssClass="MainPanel" Width="700" BorderColor="DarkBlue" BorderWidth="2px" style="overflow:auto;" >
<div>
<div class="buttonWidth">
<div>
<asp:Label ID="lblDataSync" runat="server" Text="Data Sync" /><br />
<asp:ImageButton ID="imgDataSync" ImageUrl=".\images\data_sync.bmp" runat="server"
Width="50px" Height="50px" OnClick="imgDataSync_Click" />
</div>
<div>
<asp:Label ID="lblEDI" runat="server" Text="EDI" /><br />
<asp:ImageButton ID="imgEDI" ImageUrl=".\images\edi.jpg" runat="server" Width="50px"
Height="50px" OnClick="imgEDI_Click" />
</div>
<div>
<asp:Label ID="lblShipping" runat="server" Text="Shipping/Routing" /><br />
<asp:ImageButton ID="imgShipping" ImageUrl=".\images\shipping_routing.jpg" runat="server"
Width="50px" Height="50px" OnClick="imgShipping_Click" />
</div>
<div>
<asp:Label ID="lblCompliance" runat="server" Text="Compliance/non-Compliant" /><br />
<asp:ImageButton ID="imgCompliance" ImageUrl=".\images\compliance_nc.jpg" runat="server"
Width="50px" Height="50px" OnClick="imgCompliance_Click" />
</div>
<div>
<asp:Label ID="lblLabels" runat="server" Text="Labels"></asp:Label><br />
<asp:ImageButton ID="imgLabels" ImageUrl=".\images\shipping_label.jpg" runat="server"
Width="50px" Height="50px" OnClick="imgLabels_Click" />
</div>
</div>
<div class="buttonWidth">
<div>
<asp:Label ID="lblManuals" runat="server" Text="Manuals/CustomerLinks" /><br />
<asp:ImageButton ID="imgManuals" ImageUrl=".\images\manuals.bmp" runat="server" Width="50px"
Height="50px" OnClick="imgManuals_Click" />
</div>
<div>
<asp:Label ID="lblPackaging" runat="server" Text="Packaging" /><br />
<asp:ImageButton ID="imgPackaging" ImageUrl=".\images\packaging.gif" runat="server"
Width="50px" Height="50px" OnClick="imgPackaging_Click" />
</div>
<div>
<asp:Label ID="lblTesting" runat="server" Text="Testing"></asp:Label><br />
<asp:ImageButton ID="imgTesting" ImageUrl=".\images\testing.jpg" runat="server" Width="50px"
Height="50px" OnClick="imgTesting_Click" />
</div>
<div>
<asp:Label ID="lblShippingQuickReference" runat="server" Text="Shipping Quick Reference"></asp:Label><br />
<asp:ImageButton ID="imgShippingQuickReference" ImageUrl=".\images\ShippingQuickReference.jpg" runat="server" Width="50px"
Height="50px" OnClick="imgShippingQuickReference_Click" />
</div>
</div>
</div>
</asp:Panel>
<span class="panelSpace" />
<asp:Panel ID="Panel3" runat="server" CssClass="MainPanel" Width="800" BorderColor="DarkBlue" BorderWidth="2px" >
<div>
<h2>Recent Updates:</h2>
<asp:GridView ID="grdHistory" runat="server">...</asp:GridView>
<asp:LinqDataSource ID="ldsHistory" runat="server" ContextTypeName="ComplianceDataContext"
TableName="Histories" OrderBy="CreatedDate desc" />
</div>
</asp:Panel>
<span class="panelSpace" />
</div>
</asp:Panel>
</div>
</form>
</body>
Set the width of the panels not in the ASP.NET code, but in the CSS declaration, e.g.
.MainPanel {
background-color:#ccccff;
margin-bottom:10px;
margin-top:10px;
width: 700px;
}
If you do not want to set the style for all panels, but for each panel, then do something like:
<asp:Panel ID="Panel1" runat="server" CssClass="MainPanel" style="width:550px" BorderColor="DarkBlue" BorderWidth="2px" >