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

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.

Related

Changing the order of components doesn't yield desired result

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

click event for a group of controls

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

how to select last page on a radlistview datapager

I have a radlistview which has the datapager enabled...
But when I launch the website it currently loads the first datapage on the listview (i.e the first page of comments). Is there a way to change this so that it opens the last page?
Here is the current radlistview...
<telerik:RadListView ID="RadListViewComments" runat="server" AllowPaging="True" DataKeyNames="ID" DataSourceID="SqlDataSourceComments" PageSize="5">
<LayoutTemplate>
<div class="RadListView RadListViewFloated RadListView_Default">
<div class="rlvFloated rlvAutoScroll">
<div id="itemPlaceholder" runat="server">
</div>
</div>
<telerik:RadDataPager ID="RadDataPager1" runat="server">
<Fields>
<telerik:RadDataPagerButtonField FieldType="Numeric" />
</Fields>
</telerik:RadDataPager>
</div>
<ItemTemplate>
<div class="rlvI" style="width: 700px; margin-bottom: 50px" margin-right: 100%>
<asp:Label ID="ownerLabel" runat="server" Text='<%# Eval("owner") %>' /> &nbsp - &nbsp
<asp:Label ID="dateLabel" runat="server" Text='<%# Eval("commentdate")%>' />
<br />
<asp:Label ID="commentLabel" runat="server" Text='<%# Eval("comment") %>' />
</div>
</ItemTemplate>
<EmptyDataTemplate>
<div class="RadListView RadListView_Default">
<div class="rlvEmpty">
There are no previous comments.</div>
</div>
</EmptyDataTemplate>
</telerik:RadListView>
Thanks
In the code-behind you can fire a command event with the "Last" argument on PageLoad to force it to go to the last page.
See
how change the RadDataPager Page# From CodeBehind (server-side)
http://www.telerik.com/help/aspnet-ajax/datapager-overview.html

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.

web part footer does not appear

the web part footer does not appear in a webpart like this
<asp:WebPartZone ID="WebPartZone1" runat="server" style="height:100px;" CssClass="PartZone" PartChromeType="TitleAndBorder" ShowTitleIcons="true" Width="200">
<FooterStyle CssClass="PartFooterStyle" />
<PartTitleStyle CssClass="PartTitleStyle" />
<ZoneTemplate>
<asp:Panel ID="Panel2" runat="server" Width="200" Height="200">
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:Panel>
</ZoneTemplate>
</asp:WebPartZone>
what is wrong with this ?
thanks
Well I believe it's a bug cause it does not appear at any condition.

Resources