I have a web page I'm trying to set up that will show some Ajax Tables nested inside a CollapsiblePanelExtender. The table is nesting correctly, but the styles are behaving strangely. I recently started using Chrome's Inspector tool, and I think it's pointing me in the right direction, but I'm having trouble understanding why what the Inspector is showing is different from what is in my .aspx file. I've tried this in Firefox as well, and the behavior is similar, so this doesn't seem to be a Chrome-only bug.
I set overflow:hidden; in the style for the Ajax Panel that the tables are directly nested in, but when shown in a browser, a horizontal scrollbar appears, and the Inspector shows that the style has changed to overflow-y:hidden;. What could cause my style to change between the design in my .aspx file and the way it appears in the browser?
It seems the Ajax Panel I specify in my .aspx file is converted into a <div> by the browser. I can accept that. The odd part is, it appears that an additional <div> appears in the Inspector that I don't specify anywhere in my .aspx file. Where could this additional <div> be coming from?
Minimal reproduction of my .aspx file:
<%# Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site_old.Master" CodeBehind="TEST.aspx.vb" Inherits="MyProject.TEST" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
.MyCollapsePanelHeader
{
height:20px;
font-weight: bold;
padding:5px;
cursor: pointer;
vertical-align:middle;
font-size:small;
overflow:hidden;
}
.MyCollapsePanel
{
width:100%;
height:100%;
border: 1px solid #BBBBBB;
border-top: none;
overflow:hidden;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<table width="960px">
<tr>
<td> </td>
</tr>
<tr>
<td>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"
TargetControlID="PanelContent"
ExpandControlID="PanelHeader"
CollapseControlID="PanelHeader"
Collapsed="true"
TextLabelID="lblHideShow"
ExpandedText="(Hide Details...)"
CollapsedText="(Show Details...)"
ImageControlID="img"
ExpandedImage="images/minus.gif"
CollapsedImage="images/plus.gif"
SuppressPostBack="true" >
</asp:CollapsiblePanelExtender>
<asp:Panel ID="PanelHeader" runat="server" CssClass="MyCollapsePanelHeader">
<table width="100%">
<tr>
<td>
<asp:Image ID="img" runat="server" Height="16px" ImageUrl="images/plus.gif" Width="19px" />
TITLE
<asp:Label ID="lblHideShow" runat="server" Text="Label">(Show Details...)</asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr>
<td>
<asp:Panel id="PanelContent" class="MyCollapsePanel" runat="server">
<table width="100%">
<tr>
<td height="100%" runat="server">
<asp:Table ID="tbl1" runat="server" Width="100%" Height="100%"/>
</td>
<td height="100%" runat="server">
<asp:Table ID="tbl2" runat="server" Width="100%" Height="100%"/>
</td>
<td height="100%" runat="server">
<asp:Table ID="tbl3" runat="server" Width="100%" Height="100%"/>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Screenshot of Inspector Output:
I seem to have resolved this issue. I believe it was due to the fact that the CollapsiblePanelExtender and the Panel it was targeting were separated into different cells. After moving the target Panel up into the same cell as the CollapsiblePanelExtender, the scrollbars disappeared.
The <div> element is being duplicated and the overflow-y element is still present. I still don't understand why these appear the way they do. But it seems to be unrelated to why the scrollbar was showing. Since that was the issue I was originally trying to fix, I guess this counts as a solution.
Working .aspx
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<table width="960px">
<tr>
<td> </td>
</tr>
<tr>
<td>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"
TargetControlID="PanelContent"
ExpandControlID="PanelHeader"
CollapseControlID="PanelHeader"
Collapsed="true"
TextLabelID="lblHideShow"
ExpandedText="(Hide Details...)"
CollapsedText="(Show Details...)"
ImageControlID="img"
ExpandedImage="images/minus.gif"
CollapsedImage="images/plus.gif"
SuppressPostBack="true" >
</asp:CollapsiblePanelExtender>
<asp:Panel ID="PanelHeader" runat="server" CssClass="MyCollapsePanelHeader">
<table width="100%">
<tr>
<td>
<asp:Image ID="img" runat="server" Height="16px" ImageUrl="images/plus.gif" Width="19px" />
TITLE
<asp:Label ID="lblHideShow" runat="server" Text="Label">(Show Details...)</asp:Label>
</td>
</tr>
</table>
</asp:Panel>
<asp:Panel id="PanelContent" class="MyCollapsePanel" runat="server">
<table width="100%">
<tr>
<td height="100%" runat="server">
<asp:Table ID="tbl1" runat="server" Width="100%" Height="100%"/>
</td>
<td height="100%" runat="server">
<asp:Table ID="tbl2" runat="server" Width="100%" Height="100%"/>
</td>
<td height="100%" runat="server">
<asp:Table ID="tbl3" runat="server" Width="100%" Height="100%"/>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Related
i want to show a image in a repeater , image source is database. and datatype is varbinary(max). While adding image tag getting error saying -
"The server tag is not well formed."
how to add image in a data as well as image in a repeater control.
code
<asp:Repeater ID="RepterDetails" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate>
<table style="border:1px solid #0000FF; width:500px" cellpadding="0">
<tr>
<td colspan="2">
<b>Testimonial</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table >
<tr>
<td >
Comments:
<asp:Label ID="lblSubject" runat="server" Text='<%#Eval("comment") %>'/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblComment" runat="server" Text='<%#Eval("designation") %>'/>
</td>
</tr>
</ItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" Height="100px" Width="100px" runat="server" ImageUrl="<%# "data:Image/png;base64," + Convert.ToBase64String((byte[])Eval("organizationLogo")) %>"/>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
You need to either escape your double quotes or use a single quote for ImageUrl attribute.
so this
ImageUrl="<%# "data:Image/png;base64,"+Convert.ToBase64String((byte[])Eval("organizationLogo")) %>"
becomes this...
ImageUrl='<%# "data:Image/png;base64," + Convert.ToBase64String((byte[])Eval("organizationLogo")) %>'
I'm using a repeater to present multiple items in a list.
I want to separate the items by a line using a <hr> tag. If I omit it, there's no line; however if I add it, it displays TWO line in the browser. Anyone have a suggestion for this?
Source code of the repeater:
<asp:Repeater ID="Lijst" runat="server" DataSourceID="SqlDataSource2"
OnItemDataBound="Lijst_ItemDataBound"
>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<table style="width:100%">
<tr>
<td style="width:100%">
<asp:Label ID="Regel" runat="server"></asp:Label>
</td>
<td style="width:100%">
<asp:Label ID="Plancode" runat="server" font-size="20px" align=right></asp:Label>
</td>
</tr>
<hr />
</table>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
Rendering of one item:
<table style="width:100%">
<tr>
<td style="width:100%">
<span id="MainContent_Lijst_Regel_1"></span>
</td>
<td style="width:100%">
<span id="MainContent_Lijst_Plancode_1" align="right" style="font-size:20px;"></span>
</td>
</tr>
<hr />
</table>
Thanks in advance!
you can use a separator template and inside it insert
<asp:Repeater runat="server" ID="rp">
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:Repeater>
I have one page with name Template Management for listing all available html templates. Now i have problem with setting my literal control with specific height and width.
Here is my page source for general idea on how i set this html content to literal control :
<ItemTemplate>
<div class="thumb" align="center" style="height:150px;width:130px">
<table width="100%" align="center">
<tr>
<td>
<asp:Literal ID="Literal4" runat="server" Text='<%# Eval("TemplateBody")%>'></asp:Literal>
<ajaxToolkit:HoverMenuExtender ID="hme1" runat="Server"
TargetControlID="Literal4"
PopupControlID="Panel2"
DynamicContextKey='<%# Eval("Id") %>'
DynamicControlID="Panel2"
DynamicServiceMethod="GetDynamicContent"
PopupPosition="Right"
OffsetX="-25"
OffsetY="15"/>
</td>
</table>
</div>
<table width="50%" align="left" style="border-color:Black;border-style:solid;border-width:1px;">
<tr>
<td align="center">
<table>
<tr>
<td><asp:CheckBox ID="ChkSelect" runat="server" onclick = "Check_Click(this)"/></td>
<td><asp:LinkButton ID="LinkButton2" runat="server" CssClass="quicklink"
Text='<%# Eval("TemplateName") %>' CommandName="ViewTemplate"
CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
<br/>
<asp:Label ID="Label2" runat="server" CssClass="normaltext"
Text='<%# DataBinder.Eval(Container.DataItem, "CreatedDate", "{0:dd/MM/yyyy}") %>'
ToolTip='<%# Bind("CreatedDate","{0:F}") %>'></asp:Label></td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
Can someone please suggest how to resolve this issue?
use iframes and set all content with fixed height and width. here use srcdoc not supported with ie but all browser shows it's content with fixed heigth and width.
I created a linqdatasource connection to my sql server and i load my data inside a listview.
Now for that listview i added another table from the top of that listview like a title.(i also tried div or p)
The issue now is when i add this module to my website there is a gap between the listview and the top item whether its a table or a dive or anything.
Inside visual studio it show fine with no gap. Here is my code:
<%# Control Language="VB" ClassName="MyModules.ProductDetailsModule" Inherits="DotNetNuke.Entities.Modules.PortalModuleBase" %>
<%# Import Namespace="CodingStaff.Modules.MenuBox.Licensing" %>
<script runat="server">
Dim prodID As Integer
</script>
<%
prodID = Convert.ToInt32(Request.QueryString("ProductID"))
%>
<style type="text/css">
h1 {
font-family: Lucida Grande;
font-size: 15px;
}
td {
font-family: Lucida Grande;
font-size: 13px;
color: #999999;
}
</style>
<table style="width: 704px;">
<tr style="width: 704px;">
<td>
<table>
<tbody>
<tr bgcolor="#e7e7e5" height="35">
<td align="left" style="width: 704px;">
<h1 style="color: #666666;">Technical info</h1>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<asp:ListView ID="ListView1" runat="server" DataKeyNames="PRODUCTID" DataSourceID="LinqDataSource1">
<ItemTemplate>
<tr>
<td runat="server" style="width:352px"><strong>Product Code:</strong></td>
<td style="width:352px"><strong>
<asp:Label ID="PRODUCTIDLabel" runat="server" Text='<%# Eval("PRODUCTID") %>' /></strong>
</td>
</tr>
<tr>
<td runat="server" style="width:352px"><strong>Name:</strong></td>
<td style="width:352px"><strong>
<asp:Label ID="PRODUCTNAMELabel" runat="server" Text='<%# Eval("PRODUCTNAME") %>' /></strong>
</td>
</tr>
<tr>
<td runat="server" style="width:352px"><strong>Description:</strong></td>
<td style="width:352px"><strong>
<asp:Label ID="PRODUCTDESCRIPTIONLabel" runat="server" Text='<%# Eval("PRODUCTDESCRIPTION") %>' /></strong></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table runat="server" border="0" style="">
<tr runat="server" id="itemPlaceholderContainer">
<td runat="server" id="itemPlaceholder"></td>
</tr>
</table>
<div style="">
</div>
</LayoutTemplate>
</asp:ListView>
</td>
</tr>
</table>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="ProductsModule.ProductsModuleDALDataContext" EntityTypeName="" TableName="PRODUCTs" Where="PRODUCTID==#prodID">
<WhereParameters>
<asp:QueryStringParameter Name="prodID" QueryStringField="ProductID" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
And here a similar code with the same issue:
<%# Control Language="VB" AutoEventWireup="false" CodeFile="View.ascx.vb" Inherits="DesktopModules_MyModules_ProductsModule_View" %>
<asp:LinqDataSource ID="LinqDataSourceProducts" runat="server" ContextTypeName="ProductsModule.ProductsModuleDALDataContext" EntityTypeName=""
TableName="PRODUCTs" OrderBy="PRODUCTNAME" Select="new (PRODUCTID, PRODUCTNAME)">
</asp:LinqDataSource>
<style type="text/css">
td {
font-family:Lucida Grande;
color:#666666;
font-size:15px;
}
table{
margin-top: 10px;
}
A{
text-decoration:none;
}
a:link{
color:#666666;
}
a:visited{
color:#666666;
}
a:hover{
color:#666666;
}
a:focus{
color:#666666;
}
a:active{
color:#666666;
}
</style>
<asp:Table runat="server" style="width: 704px;" CellPadding="10" CellSpacing="0">
<asp:TableRow bgcolor="#e7e7e5" height="45">
<asp:TableCell align="left" style="width: 100%;" >
<p1 style="color: #666666; font-size:inherit"><strong>Product list</strong></p1>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:ListView ID="ListView1" runat="server" DataSourceID="LinqDataSourceProducts" GroupItemCount="4" DataKeyNames="PRODUCTID">
<AlternatingItemTemplate>
<td runat="server" style="background-color: #ffffff;color: #284775;" width="176">
<asp:Image ImageUrl="~/images/drop59.png" ID="Image1" runat="server" />
<a href="http://localhost/dnn7/Commercial-vehicle-lubricants/Product-line/product-details?ProductID=<%# Eval("PRODUCTID") %>" target="_self">
<asp:Label ID="PRODUCTNAMELabel" runat="server" Text='<%# Eval("PRODUCTNAME") %>' /></a>
<br />
</td>
</AlternatingItemTemplate>
<EditItemTemplate>
<td runat="server" style="background-color: #FFCC66;color: #000080;">PRODUCTID:
<asp:Label ID="PRODUCTIDLabel1" runat="server" Text='<%# Eval("PRODUCTID") %>' />
<br />
PRODUCTNAME:
<asp:TextBox ID="PRODUCTNAMETextBox" runat="server" Text='<%# Bind("PRODUCTNAME") %>' />
<br />
</td>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
<tr>
<td>No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<EmptyItemTemplate>
<td runat="server" />
</EmptyItemTemplate>
<GroupTemplate>
<tr id="itemPlaceholderContainer" runat="server">
<td id="itemPlaceholder" runat="server"></td>
</tr>
</GroupTemplate>
<InsertItemTemplate>
<td runat="server" style="">PRODUCTID:
<asp:TextBox ID="PRODUCTIDTextBox" runat="server" Text='<%# Bind("PRODUCTID") %>' />
<br />PRODUCTNAME:
<asp:TextBox ID="PRODUCTNAMETextBox" runat="server" Text='<%# Bind("PRODUCTNAME") %>' />
<br />
</td>
</InsertItemTemplate>
<ItemTemplate>
<td runat="server" style="background-color: #ffffff;color: #333333;" width="176">
<asp:Image ImageUrl="~/images/drop59.png" ID="Image1" runat="server" />
<a href="http://localhost/dnn7/Commercial-vehicle-lubricants/Product-line/product-details?ProductID=<%# Eval("PRODUCTID")%>" target="_self">
<asp:Label ID="PRODUCTNAMELabel" runat="server" Text='<%# Eval("PRODUCTNAME") %>' /></a>
<br />
</td>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="groupPlaceholderContainer" runat="server" border="0" style="background-color: #FFFFFF;border-collapse: collapse;font-family: Lucida Grande, Helvetica, sans-serif; font-size:15px; color:#999999;">
<tr id="groupPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="text-align: center;background-color: #FFCC66;font-family: Lucida Grande, Helvetica, sans-serif;color: #333333; font-size:15px;"></td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<td runat="server" style="background-color: #FFCC66;font-weight: bold;color: #000080;">PRODUCTID:
<asp:Label ID="PRODUCTIDLabel" runat="server" Text='<%# Eval("PRODUCTID") %>' />
<br />PRODUCTNAME:
<asp:Label ID="PRODUCTNAMELabel" runat="server" Text='<%# Eval("PRODUCTNAME") %>' />
<br />
</td>
</SelectedItemTemplate>
</asp:ListView>
UPDATE!!!!!
Ive looked the website from chrome with f12 to see what happens with the gap. Ive notice that on every table declaration a gap is added. here is a sample image. the orange is the gap thats generated and also below Technical info there is a gap again.
I found the problem to this. I had inside another module in another page a padding top 30px. And as it seems it shares this options to the whole site. So anywhere that a table declaration existed it added a 30px gap on top. I fixed it by making that specific 30px padding with table.aVariableName so that is dinstinct to a specific table only
How do I prevent a table from wrapping when it is inside of an outer table cell?
Have a look at the simplified example at the bottom of my question.
My aspx-tablerow:
<tr runat="server" id="trButtons">
<td align="left" colspan="9" valign="top" style="white-space:nowrap"><br />
<asp:Button ID="btnImeiLookup" OnClick="btnImeiLookupClick" runat="server" ValidationGroup="VG_RMA_LOOKUP" CausesValidation="true" Text="lookup IMEI" ToolTip="lookup IMEI and check if RMA-Number can be generated" Width="120px" />
<asp:Button ID="BtnEdit" CommandName="Edit" CommandArgument='<%# Eval("idRMA")%>' ValidationGroup="VG_RMA_SAVE" runat="server" CausesValidation="false" Text="Edit" ToolTip="edit" Width="120px" />
<asp:Button ID="BtnAdd" runat="server" CommandName="Add" CausesValidation="false" Text="Add new" Width="130px" ToolTip="add new" />
<asp:Button ID="BtnDelete" runat="server" CommandName="Delete" CommandArgument='<%# Eval("idRMA")%>' CausesValidation="true" Text="Delete" Width="120px" ToolTip="delete" OnClientClick="return confirm('do you really want to delete this RMA?')" />
<uc4:RmaPrinterView ID="RmaPrinterView1" Visible="true" runat="server" />
</td>
</tr>
RmaPrinterView1 is an ASP.Net Usercontrol:
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="button" style="width:120px; white-space:nowrap" onclick="javascript:$('#TblPrinterView').jqprint();" value="Print" title="Print" />
</td>
</tr>
<tr>
<td>
<table id="TblPrinterView" style="display:none">
<tr>
<td style="width:100px;white-space:nowrap">
<asp:Label ID="LblRmaNumberDesc" runat="server" Text="RMA-Number:"></asp:Label>
</td>
<td>
<asp:Label ID="LblRmaNumber" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblImeiDesc" runat="server" Text="IMEI:"></asp:Label>
</td>
<td>
<asp:Label ID="LblImei" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblModelDesc" runat="server" Text="Model:"></asp:Label>
</td>
<td>
<asp:Label ID="LblModel" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSiDpyDesc" runat="server" Text="SI/DPY:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSiDpy" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSymptomCodesDesc" runat="server" Text="Symptoms:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSymptomCodes" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
As you can see, the Usercontrol with the inner table is wrapped:
I know that I should avoid table layout, but I needed a fast working solution ;-)
EDIT: a simplified sample that is also wrapping:
<table>
<tr>
<td style="white-space:nowrap">
<input type="button" value="b1" />
<input type="button" value="b2" />
<input type="button" value="b3" />
<table>
<tr>
<td style="white-space:nowrap"><input type="button" value="in table" /></td>
</tr>
</table>
</td>
</tr>
</table>
UPDATE:
The solution - as Jeroen mentioned - was to make the table an inline element with style="display: inline". The next problem was that I used an ASP.Net UpdatePanel inside the UserControl which is normally rendered as a Div. So the next block-element that causes my table to wrap. I only needed to set the UpdatePanel's RenderMode to Inline what causes it to be rendered as Span.
If the css white-space does not work, you can try to add nowrap="nowrap" to your td, just like you added valign="top".
Very ugly, but it should work.
Edit: Ah, now I see: A table is a block-level element so it will always go to a new line unless you make it an inline-element or float it.
table tr td {
white-space: nowrap;
}
You've put the table at odds with itself. It is set to finite pixel count and yet you don't want to wrap once that's exceeded. You might attempt:
white-space: nowrap;
overflow: hidden;