Changing the order of components doesn't yield desired result - css

I have been trying to get the "Contact Us" part of this aspx to show up after the "Custom dial" part, but for some reason no matter what I try the custom dial is appearing after, not before. Does anyone know what I need to do to get the contact us link to move to the right side of the custom dial? This is driving me crazy.
<div style="clear: both;">
<asp:Panel ID="pnlLogo" runat="server" Visible="false" CssClass="logo_holder">
<asp:HyperLink runat="server" ID="LogoLink">
<asp:Image ID="imgLogoAdm" CssClass="logo" ImageUrl="~/Images/CompanyLogo.png" runat="server" />
</asp:HyperLink>
<span class="slogan"><strong>This is <br />
Our Motto</strong></span>
<span>
<br />
<asp:Label ID="Label1" runat="server" Width="25px"> </asp:Label>
<asp:HyperLink runat="server" ID="CustomDialHyperlink">
<asp:Image runat="server" ID="imgCustomDial" Width="160px" Height="80px" Visible="false" />
</asp:HyperLink>
</span>
<span class="contact_info">
<asp:HyperLink ID="ContactUs" NavigateUrl="~/ContactUs.aspx" runat="server"><strong>Contact Us</strong></asp:HyperLink>
</span>
</asp:Panel>
</div>
Thanks

Related

List items disappear after postback

I am having lots of problems with my dropdownlist. My dropdownlist controls disappear after postback.
The idea is that if in the drop down list I choose Spain, the ddlProvincia control shows the Spanish provinces. However, if I choose any country other than Spain, I should show the textbox "tbProvinciaNombre".
The problem is that when I select a country in the "ddlPais" control the list items of this control and "ddlProvincia" disappear completely.
Any help is welcome.
Thank you.
<asp:UpdatePanel ID="upProvinciaNombre" runat="server" UpdateMode="Conditional" class="col-md-6 form-group">
<ContentTemplate>
<!-- Provincia -->
<div id="panelDdlProvincia" runat="server" visible="true">
<asp:Label runat="server" AssociatedControlID="ddlProvincia">Provincia</asp:Label><span class="requerido">*</span>
<asp:DropDownList ID="ddlProvincia" runat="server" CssClass="form-control selectpicker" />
<asp:RequiredFieldValidator ID="rfvddlProvincia" runat="server" ErrorMessage="Seleccione una opción" CssClass="invalid-feedback" Text="*" InitialValue="none" ControlToValidate="ddlProvincia" ValidationGroup="ValidationButton"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="vceRfvddlProvincia" runat="server" TargetControlID="rfvddlProvincia" HighlightCssClass="error" CssClass="oculto" />
</div>
<!-- Provincia Nombre -->
<div id="panelTbProvinciaNombre" runat="server" visible="false">
<asp:Label runat="server" ID="lbProvinciaNombre" AssociatedControlID="tbProvinciaNombre">Provincia</asp:Label><span class="requerido">*</span>
<asp:TextBox ID="tbProvinciaNombre" runat="server" CssClass="form-control"></asp:TextBox>
<div>
<asp:RequiredFieldValidator ID="rfvTbProvinciaNombre" runat="server" CssClass="invalid-feedback" ControlToValidate="tbProvinciaNombre" Display="Dynamic" ValidationGroup="ValidationButton" ErrorMessage="Introduzca una provincia válida" />
<ajax:ValidatorCalloutExtender ID="vceRfvTbProvinciaNombre" runat="server" TargetControlID="rfvTbProvinciaNombre" HighlightCssClass="error" CssClass="oculto" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<!-- Pais -->
<asp:UpdatePanel ID="upPais" runat="server" UpdateMode="Conditional" class="col-md-6 form-group">
<ContentTemplate>
<asp:Label runat="server" AssociatedControlID="ddlPais">Pais</asp:Label><span class="requerido">*</span>
<asp:DropDownList ID="ddlPais" runat="server" CssClass="form-control selectpicker" AutoPostBack="true" />
<asp:RequiredFieldValidator ID="rfvddlPais" runat="server" ErrorMessage="Seleccione una opción" CssClass="invalid-feedback" Text="*" InitialValue="none" ControlToValidate="ddlPais" ValidationGroup="ValidationButton"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="vceRfvddlPais" runat="server" TargetControlID="rfvddlPais" HighlightCssClass="error" CssClass="oculto" />
</ContentTemplate>
</asp:UpdatePanel>
<!-- Políticas -->
<div class="col-md-12 form-group">
<div class="checkbox">
<asp:CheckBox ID="cbPoliticas" runat="server" />
<asp:Label runat="server" ID="politicas" AssociatedControlID="cbPoliticas">He leído y acepto la
<asp:HyperLink ID="hlkPoliticaPrivacidad" runat="server" Target="_blank" NavigateUrl="~/contenidos/privacidad.aspx" Text="política de privacidad" />
y el
<asp:HyperLink ID="hlkAvisoLegal" runat="server" Target="_blank" NavigateUrl="~/contenidos/avisoLegal.aspx" Text="aviso legal" />
del sitio web.
</asp:Label>
<div>
<asp:TextBox ID="tbFakeCv" runat="server" CssClass="oculto" />
<asp:CustomValidator runat="server" ID="cvCbPoliticas" ErrorMessage="Es obligatorio aceptar la política de privacidad" CssClass="error" Display="Dynamic" ControlToValidate="tbFakeCv" ValidateEmptyText="true" ValidationGroup="ValidationButton" />
<ajax:ValidatorCalloutExtender ID="vceCvCbPoliticas" runat="server" TargetControlID="cvCbPoliticas" HighlightCssClass="error" CssClass="oculto" />
</div>
</div>
</div>
The solution was really simple. In my case, I was using the class "selectpicker", but I assumed that this functionality was implemented in the .js file. But no, It was missing. Just add the following code in the .js file and everything is working like a charm.
Sorry. I just want to comment it because sometimes the frontend and backend are responsible of different people, and a error in one part could be a pain in the ass to the other member of the team.
// Selectpicker
if ($.fn.selectpicker) {
$('.selectpicker:not(.jQ_todos)').selectpicker();
$('.selectpicker.jQ_todos').selectpicker({ noneSelectedText: 'Todos' });
}

Why some div content is missing from ZoneTemplate in asp.net webpart?

Here is my code:
<asp:WebPartZone ID="Zone1" runat="server" Width="100%" PartChromeType="None" Padding="0" PartStyle-CssClass="NoPadding"
PartStyle-BackColor="Transparent" BackColor="Transparent" PartChromeStyle-BackColor="Transparent">
<PartStyle BackColor="Transparent"></PartStyle>
<CloseVerb Visible="false" />
<MinimizeVerb Visible="false" />
<ZoneTemplate>
<div class="demo">
<p>Procedure Queues</p>
</div>
<div class="demoBottom">
<div class="divPortletContent">
<br />
<asp:DataList ID="dlProcedureQueues" runat="server" >
<ItemTemplate>
<asp:HyperLink ID="lbProcedureQueues" runat="server" Text='<%# Eval("site_nm") %>' NavigateUrl='<%# Eval("site_url") %>' />
</ItemTemplate>
</asp:DataList>
</div>
</div>
</ZoneTemplate>
</asp:WebPartZone>
The text from <div class="demo"><p>Procedure Queues</p></div> is miising and it works if I put it outside of webpart. Also, I am loosing all the css styles when placed inside webpart's ZoneTemplate.
Any ideas?? Thanks in advance.
Let me answer my own question. From what I found out, ZoneTemplate only considers the asp controls (including user controls) as web parts and ignores all the html.

asp.net ModalPopupExtender not behaving properly

I have the following code on a .aspx file. If I comment out the ModalPopupExtender code works fine.:
<cc1:ModalPopupExtender BehaviorID="mdlPopup" runat="server" TargetControlID="btn"
ID="mdl1" PopupControlID="pnlPopup" OkControlID="LinkButton1" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlPopup" runat="server" CssClass="confirm-dialog" Style="display: none;">
<div class="inner">
Work Order #: <asp:TextBox ID="txtWorkOrder" runat="server" Width="285" Text=""></asp:TextBox><br /><br />
Please Enter Corrective Actions<br />
<asp:TextBox ID="TextBox2" runat="server" Height="150" Width="285" TextMode="MultiLine"
Text=""></asp:TextBox>
<asp:Button ID="btnOK" runat="server" Font-Bold="true" Text="Submit" OnClick="click"
Width="150" />
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="close" OnClick="cancel" />
</div>
</asp:Panel>
<asp:Button ID="btn" runat="server" Style="display: none;" />
<asp:Label ID="id" runat="server" Text="Label" Visible="false"></asp:Label>
The problem that I am having is that the page just hangs when I have this code in the .aspx file. Is there anything I should do. It does not even get to the Page_Load.
I am calling this page that has the above code with the following:
string url = "Alerts.aspx?";
url += "ID=" + id.Text;
Response.Redirect(url);

Using DataList control to redirect user on other page and fetch data on that page depending on the button clicked in previous page

I am using a datalist control in which i have a div and some other asp controls.
I have an edit button in it. If I click on edit button, I want to redirect user to another page on which I have some controls and I want information to be filled up in those controls depending upon the button I have clicked in previous page.
Here is the datalist code:
<asp:DataList ID="DataList1" runat="server" DataKeyField="ID" RepeatColumns="2" RepeatDirection="Horizontal" RepeatLayout="Table">
<ItemTemplate>
<div><br /><br /><br />
<div style="background-color:Silver;height: auto; display:block;" >
<div id="threadPostLeftDiv" style="width:auto; border-style:solid; border-width:2px; border-color:Black;border-right-color:White;" >
<asp:Image runat="server" ID="ImagePreview1" style="margin-right:5px; " ImageUrl='<%# Eval("imageurl") %>' Height="100px" Width="100px" BorderStyle="None" />
</div>
<div id="threadPostRightDiv" style=" border-style:solid; border-width:2px;margin-left:-15px; border-color:Black;border-left-color:White;">
<asp:Label ID="txtHeadline1" CssClass="inputprev" style=" font-size:medium; font-weight:bolder;" Text='<%# Eval("subtitle") %>' Enabled="false"
placeholder="Headline" runat="server"></asp:Label>
<br />
<asp:Textbox ID="txtDescription1" CssClass="inputprevdesc1" Text='<%# Eval("descriptions") %>'
Enabled="false" BackColor="Silver" Rows="3" TextMode="MultiLine" placeholder="Description" runat="server"></asp:Textbox><br />
<br />
<asp:Label ID="txtOfferHeadline1" Text='<%# Eval("title") %>' Enabled="false" CssClass="inputprev1"
placeholder="Offer Headline" runat="server"></asp:Label>
<br />
</div>
</div>
<div style=" float: right;margin-right:10px; ">
<button id="btnEdit" class="css3button1" onserverclick="btnEdit_Click" runat="server">Edit</button>
</div>
</div>
</asp:DataList>
Please help me in acheiving my goal,give me the code behind file and what events to triggers.
Thank you.
Well that can be easily achived by doing the following things
bind 'btnEdit' commandargument with the id
<button id="btnEdit" class="css3button1" onserverclick="btnEdit_Click" runat="server" CommandArgument='<%# Eval("ID") %>' >Edit</button>
in btnEdit_Click event do the following
Button bt = (Button)sender;
string recordid = bt.CommandArgument;
Response.Redirect("editrecordno.aspx?recordid="+recordid,true);
in editrecordno.aspx page request the querystring and do the need full.
in Button_Click event you shoul redirect to another page with QueryString paramater
Replace your edit <button> with this code line
<asp:Button ID="Button1" PostBackUrl='DataEdit.aspx?id=<%# Eval("id") %>' runat="server" Text="Edit" />
In DataEdit.aspx put your FormView with DefaultMode=Edit
Then Add new QueryString Parameter in your DataSource
I converted html button to link button and fired onRowCOmmand event and I got my solution.

ASP.NET Panel Not Ending

I have created an ASP.NET page with an AJAX Accordion control. Within on the panes are several controls, some of which I've placed inside a Panel control, for various reasons.
However, controls which are on the page AFTER the closing tag for the panel are appearing INSIDE the panel when the page is rendered. For the life me I can't figure out why, and it's driving me crazy! Even clicking on the header of the Accordion Pane after the one containing the panel doesn't cause the Pane to expand, which it did before I added the Panel, seemingly because even IT is behaving as if it's within the Panel!
Any ideas what I'm doing wrong? How can I make the page believe that the panel ends!!?
<asp:Accordion ID="accQuestionnaire" runat="server" RequireOpenedPane="false" ContentCssClass="AccordionContent" HeaderCssClass="AccordionHeader" FadeTransitions="true"
transitionduration="250" HeaderSelectedCssClass="AccordionSelected" SelectedIndex="0" SuppressHeaderPostbacks="true" >
<Panes>
<%--START OF Tristan Link Pane (0)-------------------------------------------------------------%>
<asp:AccordionPane ID="pnTristanLink" runat="server" ContentCssClass="AccordionContent" ViewStateMode="Enabled" >
<Header>
Tristan Link
</Header>
<Content>
<div class="centrebuttonsdiv" >
<asp:Button ID="btnSearchTristan" runat="server" CssClass="largebutton" Text="Search Tristan" /><br />
</div>
<asp:Panel ID="pnlTristanSearch" runat="server" CssClass="panel" >
<div class="leftdiv"> <%--Matching Tristan results--%>
<asp:FormView ID="fvTristanSearch" runat="server" CssClass="FormView" >
<ItemTemplate>
<asp:Label ID="lblTristanSearchLabel" runat="server" CssClass="fieldtitle" Text="The information from Tristan for this Case Number is:" /><br /><br />
<asp:Label ID="lblAnimalNameLabel" runat="server" CssClass="fieldtitle" Text="Horse Name: " />
<asp:Label ID="lblAnimalName" runat="server" Text='<%# Eval("PetName") & " " & Eval("ClientNameLast") %>' /><br />
<asp:Label ID="lblGenderLabel" runat="server" CssClass="fieldtitle" Text="Sex: " />
<asp:Label ID="lblGender" runat="server" Text='<%# Eval("L_GenderDesc") %>' /><br />
<asp:Label ID="lblBreedLabel" runat="server" CssClass="fieldtitle" Text="Breed: " />
<asp:Label ID="lblBreed" runat="server" Text='<%# Eval("L_BreedDesc") %>' /><br />
<asp:Label ID="lblDOBLabel" runat="server" CssClass="fieldtitle" Text="DOB: " />
<asp:Label ID="lblDOB" runat="server" Text='<%# Eval("PetDOB", "{0:d}") %>' /><br /><br />
</ItemTemplate>
</asp:FormView>
</div>
<div class="rightdiv">
<br /><br />
<asp:Label ID="lblUnmatchedAppointments" runat="server" Text="Appointments for this horse with no Colic Study details:" Visible="false" /><br />
<asp:ListBox ID="lstUnmatchedAppointments" runat="server" DataSourceID="SQLUnmatchedAppointments" DataTextField="AppointmentDate" DataTextFormatString="{0:d}" DataValueField="AppointmentID"
Visible = "False" />
</div>
<div class="cleardiv" />
</asp:Panel>
<div class="centrebuttonsdiv" >
<asp:Label ID="lblTristanSearchInstructions" runat="server" Text="Select an appointment from the list above and click 'Save Section' to continue. Otherwise, click 'Clear Retrieved Information'
to search again" Visible="false" /><br />
<asp:Button ID="btnClearTristanSearch" runat="server" Text="Clear Retrieved Information" Visible="false" CssClass="largebutton" />
<asp:Button ID="btnSaveTristanLink" runat="server" Text="Save Section" OnClientClick="disablePanes()" Visible="false" Enabled="false" CssClass="largebutton" />
</div>
</Content>
</asp:AccordionPane>
I believe that changing this line:
<div class="cleardiv" />
to this
<div class="cleardiv"></div>
will solve that rendering problem; <div> is not typically a self-closing tag.

Resources