I have to fix header of table when i scroll down i want to see column header till the end of records. i made this but i am facing a problem. i fetch data from database that's a dynamic data so when i display that in table the layout gets odd. because if there is a column with more than 1000 words that will change its width while i mention table cell width with percentage. how i can solve this problem that header remain on the top and the layout will not be disturbed what ever data is. i do not want to use jQuery
.gridScrollDiv
{
border:1px solid #CCCCCC;
height: 500px;
overflow: scroll;
overflow-x: hidden;
}
<div class="gridScrollDiv">
<table id="tblData" class="grid" style="width: 100%;" cellpadding="0">
<thead style="position:absolute;">
<tr>
<th style="width:40%;">
Code
</th>
<th style="width:40%;">
Description
</th>
<th style="width:20%;">
Date
</th>
</tr>
</thead>
<tbody>
<asp:Repeater ID="rptLoation" runat="server">
<ItemTemplate>
<tr>
<td style="width:40%; word-wrap:breake-word;">
<%# DataBinder.Eval(Container.DataItem, "Code")%>
</td>
<td style="width:40%; word-wrap:breake-word;">
<%# DataBinder.Eval(Container.DataItem, "Description")%>
</td>
<td style="width:20%; word-wrap:breake-word;">
<%# DataBinder.Eval(Container.DataItem, "RegistrationDate")%>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</div>
you can use code like below. I have modified css.
.gridScrollDiv
{
border: 1px solid #CCCCCC;
height: 500px;
overflow-y: scroll;
}
taking out the header from the repeater.
<table style="width: 100%;">
<tr style="font-weight: bold;">
<tr>
<td style="width: 40%; text-align: left">
Code
</td>
<td style="width: 40%; text-align: left">
Description
</td>
<td style="width: 20%; text-align: left">
Date
</td>
</tr>
</table>
<div class="gridScrollDiv">
<asp:Repeater ID="rptLoation" runat="server">
<HeaderTemplate>
<table style="width: 100%;">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="width: 40%; word-wrap: breake-word;">
<div style="width: 350px; overflow-x: scroll;">
<%# DataBinder.Eval(Container.DataItem, "Code")%>
</div>
</td>
<td style="width: 40%; word-wrap: breake-word;">
<div style="width: 350px; overflow-x: scroll;">
<%# DataBinder.Eval(Container.DataItem, "Description")%>
</div>
</td>
<td style="width: 20%; word-wrap: breake-word;">
<div style="width: 350px; overflow-x: scroll;">
<%# DataBinder.Eval(Container.DataItem, "RegistrationDate")%>
</div>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
this might resolve your purpose....
Related
I have an online form which is used to send emails of some receivers.
I have a textbox which is prefilled with some email address. If for debug I put there some text strings (see image)
and press the send button (invia) I still see the real receivers in the tbReceivers.text field.
protected void btSend_Click(object sender, EventArgs e)
{
String txtPath = Path.Combine(Global.TxtPath, "ProssimoAllenamento.Txt");
StreamWriter sw = new StreamWriter(txtPath);
sw.Write(tbBody.Text);
sw.Close();
String strError;
if(Email.Send(tbReceivers.Text,Global.eUserType.COACH,"",tbBody.Text, tbSubject.Text, fuAttachment, out strError))
MessageBox.Show("Email inviata correttamente", this.Page, this);
else
MessageBox.Show("Errore invio email: " + strError , this.Page, this);
}
So by searching solution I found that I had to use an updatePanel, scriptmanager and include everything in a . But nothing happened.
Following my html
thanx for your help
Patrick
<%# Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" Inherits="Altro_Admin_Admin_Coach" Title="Admin Coach" CodeBehind="Admin_Coach.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table style="width: 100%">
<tr>
<td style="height: 22px; width: 48px"></td>
<td style="height: 22px; width: 730px">
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" Text="Prossimo allenamento"></asp:Label>
</td>
<td style="height: 22px; width: 730px"> </td>
<td style="height: 22px; width: 730px"> </td>
<td style="height: 22px"></td>
</tr>
<tr>
<td style="width: 48px; height: 22px"></td>
<td style="width: 730px; height: 22px"></td>
<td style="width: 730px; height: 22px"> </td>
<td style="width: 730px; height: 22px"> </td>
<td style="height: 22px"></td>
</tr>
<tr>
<td style="width: 48px">Destinatari</td>
<td style="width: 730px">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:TextBox ID="tbReceivers" runat="server" Height="47px" Width="707px" Font-Size="X-Small" TextMode="MultiLine"></asp:TextBox>
</td>
<td style="width: 730px"> </td>
<td style="width: 730px"> </td>
<td> </td>
</tr>
<tr>
<td style="width: 48px; height: 29px">Oggetto</td>
<td style="width: 730px; height: 29px">
<asp:TextBox ID="tbSubject" runat="server" Height="21px" Width="707px"></asp:TextBox>
</td>
<td style="width: 730px; height: 29px"> </td>
<td style="width: 730px; height: 29px"> </td>
<td style="height: 29px"></td>
</tr>
<tr>
<td style="width: 48px; height: 11px"></td>
<td style="height: 11px; width: 730px">
<asp:TextBox ID="tbBody" runat="server" Height="344px" Width="707px" TextMode="MultiLine" Style="vertical-align: top;"></asp:TextBox>
<br />
<asp:FileUpload ID="fuAttachment" runat="server" BackColor="White" Width="715px" />
</td>
<td style="height: 11px; width: 730px"> </td>
<td style="height: 11px; width: 730px"> </td>
<td style="height: 11px"></td>
</tr>
<tr>
<td style="width: 48px; height: 41px"> </td>
<td style="height: 41px; width: 730px">
<asp:Button ID="btSend" runat="server" Height="45px" OnClick="btSend_Click" Text="INVIA" Width="714px" />
</td>
<td style="height: 41px; width: 730px"> </td>
<td style="height: 41px; width: 730px"> </td>
<td style="height: 41px"> </td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
I have a page that displays a pdf report in a RadWindow via javascript, but for some reason it has two sets of vertical scrollbars: one created by Internet Explorer and one in the PDF itself.
I am displaying other PDF reports in the exact same fashion, the only difference between this one that I can see is that the report is loaded from a different domain(just different port in the development environment, still the same physical server either way).
This does not happen on Chrome, only on IE. And I can't even seem to get either of the scrollbars removed even using the DOM editor in IE's development tools.
I've tried giving the radwindow a CSS class which set overflow to hidden and display inline, the report page itself also has html and body with those settings.
Here is the javascript code I use to open the radwindow:
function showRadWindowSupply(url, title) {
var oWnd = $find("<%=_rwInvoice.ClientID%>");
oWnd.setUrl(url);
oWnd.set_title(title);
oWnd.show();
sizeRadWindowSupply(oWnd, 70, 80);
return false;
}
function sizeRadWindowSupply(oWnd, width, height) {
var browserWidth = $telerik.$(window).width();
var browserHeight = $telerik.$(window).height();
oWnd.setSize(Math.ceil(browserWidth * width / 100), Math.ceil(browserHeight * height / 100));
oWnd.center();
}
Here is the RadWindow markup used on the aspx page:
<telerik:RadWindowManager id="_rwm1" runat="server">
<Windows>
<telerik:RadWindow ID="_rwInvoice" runat="server" Behaviors="Close,Maximize" CssClass="holdsSplitter" AutoSize="false" VisibleStatusbar="false" Modal="true" ></telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
And here is the HTML that is generated for the RadWindow:
<div class="RadWindow RadWindow_Telerik rwNormalWindow rwTransparentWindow holdsSplitter" id="RadWindowWrapper_ctl00_ContentPlaceHolder1__rwInvoice" style="left: 204px; top: 58px; width: 957px; height: 472px; visibility: visible; position: absolute; z-index: 3001; -ms-touch-action: none; transform: none; backface-visibility: visible;" unselectable="on">
<table class="rwTable" style="height: 433px;" cellspacing="0" cellpadding="0">
<tbody>
<tr class="rwTitleRow">
<td class="rwCorner rwTopLeft"> </td>
<td class="rwTitlebar">
<div class="rwTopResize">
<!-- / -->
</div>
<table align="left" class="rwTitlebarControls" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width: 16px;"><a class="rwIcon"></a></td>
<td><em style="width: 847px;" unselectable="on">Supply Orders Invoice</em></td>
<td nowrap="" style="white-space: nowrap;">
<ul class="rwControlButtons" style="width: 62px;">
<li><a title="Maximize" class="rwMaximizeButton" href="javascript:void(0);"><span>Maximize</span></a></li>
<li><a title="Close" class="rwCloseButton" href="javascript:void(0);"><span>Close</span></a></li>
</ul>
</td>
</tr>
</tbody>
</table>
</td>
<td class="rwCorner rwTopRight"> </td>
</tr>
<tr class="rwContentRow">
<td class="rwCorner rwBodyLeft"> </td>
<td class="rwWindowContent rwExternalContent" valign="top">
<iframe name="_rwInvoice" src="http://devsvr:87/Reports/StaticReports/OrderHistoryDetail.aspx?ID=1748" frameborder="0" style="border: 0px currentColor; width: 100%; height: 100%;"></iframe>
</td>
<td class="rwCorner rwBodyRight"> </td>
</tr>
<tr class="rwStatusbarRow" style="display: none;">
<td class="rwCorner rwBodyLeft"> </td>
<td class="rwStatusbar">
<table align="left" style="width: 100%;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width: 100%;">
<input tabindex="-1" class="rwLoading" id="ctl00_ContentPlaceHolder1__rwInvoice_status" readonly="" unselectable="on"><label style="display: none;" for="ctl00_ContentPlaceHolder1__rwInvoice_status">status label</label></td>
</tr>
</tbody>
</table>
</td>
<td class="rwCorner rwBodyRight"> </td>
</tr>
<tr class="rwFooterRow">
<td class="rwCorner rwFooterLeft"> </td>
<td class="rwFooterCenter"> </td>
<td class="rwCorner rwFooterRight"> </td>
</tr>
</tbody>
</table>
</div>
Any suggestions are greatly appreciated.
I'm trying to get an HTML markup that represents the following table layout:
I tried this but it's not working:
<table border="1">
<tr>
<td style="height: 800px">
1
</td>
<td style="width: 300px; height: 400px">
2
</td>
</tr>
<tr>
<td style="height: 200px">
<p>3</p>
</td>
<td style="height: 600px">
4
</td>
</tr>
</table>
This looks pretty close to the image you provided. It's a little tricky because it actually requires 3 rows, but once you get your head wrapped around rowspan, then it makes sense.
<table border="1">
<tr style="height: 200px;">
<td style="width: 400px;" rowspan="2">
1
</td>
<td style="width: 200px;">
2
</td>
</tr>
<tr style="height: 200px;">
<td rowspan="2">
4
</td>
</tr>
<tr style="height: 50px;">
<td>
<p>3</p>
</td>
</tr>
</table>
You just need to add another row and add rowspans:
<table border="1">
<tr>
<td style="width: 300px; height: 400px" rowspan="2">
1
</td>
<td style="width: 300px; height: 200px">
2
</td>
</tr>
<tr>
<td style="height: 200px" rowspan="2">
4
</td>
</tr>
<tr>
<td style="height: 100px">
3
</td>
</tr>
</table>
See jsfiddle: http://jsfiddle.net/mt009cha/
EDIT
Do you have to use tables? This seems more like a layout and divs might be more appropriate.
Html:
<div class="container">
<div class="left">
<div style="height: 498px">1</div>
<div style="height: 98px">3</div>
</div>
<div class="right">
<div style="height: 298px">2</div>
<div style="height: 298px">4</div>
</div>
</div>
CSS:
div {
border: 1px solid black;
}
.container {
width: 600px;
height: 600px;
}
.left {
width: 398px;
height: 100%;
float: left;
}
.right {
width: 198px;
height: 100%;
float: right;
}
See jsfiddle: http://jsfiddle.net/zynt5j7e/
FIDDL
If you must use tables:
<table class="tbl">
<tr>
<td>
<table>
<tr>
<td style="height: 800px">
<p>top left</p>
</td>
</tr>
<tr>
<td style="height: 200px">
<p>bottom left</p>
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td style="height: 400px">
<p>top left</p>
</td>
</tr>
<tr>
<td style="height: 600px">
<p>bottom left</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
Some CSS:
.tbl, .tbl table { border-collapse: collapse; width:100%; }
.tbl td, .tbl table td{ border:1px solid black; padding:0; margin: 0; }
I want to show in my view list of all comments from database. But sometimes, comments ale very long. I tried to "break" them with word-wrap:break-word, but with no result - comments like this
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
extend my view..
and I want to show:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
How to do it? CSS Width property also don't work.
Here is my code:
<table style="width: 100%;">
#foreach (var comment in Model.commentList)
{
<tr style="border-bottom:1pt solid black;">
<td style="width: 30%;">
<br />
#comment.UserName<br /><br />
#comment.AddDate
</td>
<td style="word-wrap:break-word; width: 70%;">
<br />
#comment.Content
</td>
</tr>
}
</table>
Actually word-wrap: break-word doesn't seem to work normally in tables. There is a fix for it though. Try the following code (note the additional table-layout: fixed in the table tag).
<table style="table-layout: fixed; width: 100%;">
#foreach (var comment in Model.commentList)
{
<tr style="border-bottom:1pt solid black;">
<td style="width: 30%;">
<br />
#comment.UserName<br /><br />
#comment.AddDate
</td>
<td style="word-wrap:break-word; width: 70%;">
<br />
#comment.Content
</td>
</tr>
}
</table>
I have 3 tables, cascading one after the other. I have a div, that I want to place on right side of these tables. The height of div may vary according to text inside. Currently the div is displayed below tables, like the image below;
<table class="class1" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell1</td>
<td class="cell2">Cell2</td>
</tr>
<tr>
<td class="cell1">Cell3</td>
<td class="cell2">Cell4</td>
</tr>
</table>
<table class="class2" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell5</td>
<td class="cell2">Cell6</td>
</tr>
<tr>
<td class="cell1">Cell7</td>
<td class="cell2">Cell8</td>
</tr>
</table>
<table class="class3" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell9</td>
<td class="cell2">Cell10</td>
</tr>
<tr>
<td class="cell1">Cell11</td>
<td class="cell2">Cell12</td>
</tr>
</table>
<div class="mydiv">mydiv</div>
But I want to place the div next to tables, so that it can extend downwards.
Here is the working fiddle http://jsfiddle.net/ZHVuf/1/
You should add a container around you table like this :
Html
<div id="container">
<!-- Your table -->
</div>
And make him float left, like your div #myDiv
Css
#container {
float:left;
}
see updated fiddle.
On this second updated fiddle, I added a wrapper with a clearfix !
insertusernamehere commented that you could use overflow:hidden instead of the clearfix, see here for a new working way to do this with less code.
Apply float:left; to all the table and add clear:both; to second and third table.
now you already has float:left; for div just add position:relative;top:0; and see.
OR
create two divs and add tables in one with left floating and you already have second div.
<div class="tableContainerDiv" style="float:left;">
<table><tr><td></td></tr></table>
<table><tr><td></td></tr></table>
<table><tr><td></td></tr></table>
</div>
<div class="yourDiv" style="float:left;"></div>
html
<div class="cl">
<div style="float: left">
your tables
</div>
<div class="mydiv" style="float: left">mydiv</div>
</div>
css
.cl:after{ content: " "; display: block; height: 0px; clear: both; visibility: hidden;}
.cl {display: inline-block;}
/* Hides from IE-mac \\*/
* html .cl {height: 1%;}
.cl {display: block;}
/* End hide from IE-mac */
move tables inside another div , float to left;
HTML
<div class="table-wrap">
<table class="class1" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell1</td>
<td class="cell2">Cell2</td>
</tr>
<tr>
<td class="cell1">Cell3</td>
<td class="cell2">Cell4</td>
</tr>
</table>
<table class="class2" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell5</td>
<td class="cell2">Cell6</td>
</tr>
<tr>
<td class="cell1">Cell7</td>
<td class="cell2">Cell8</td>
</tr>
</table>
<table class="class3" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell9</td>
<td class="cell2">Cell10</td>
</tr>
<tr>
<td class="cell1">Cell11</td>
<td class="cell2">Cell12</td>
</tr>
</table>
</div>
<div class="mydiv">mydiv</div>
CSS
.class1{
width: 100px;
height: 100px;
background: orange;
}
.class2{
width: 100px;
height: 100px;
background: green;
}
.class3{
width: 100px;
height: 100px;
background: gray;
}
.mydiv{
width: 200px;
background: blue;
float: left
}
.table-wrap{float:left;}
<table>
<tr><td>
<table class="class1" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell1</td>
<td class="cell2">Cell2</td>
</tr>
<tr>
<td class="cell1">Cell3</td>
<td class="cell2">Cell4</td>
</tr>
</table>enter code here
<table class="class2" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell5</td>
<td class="cell2">Cell6</td>
</tr>
<tr>
<td class="cell1">Cell7</td>
<td class="cell2">Cell8</td>
</tr>
</table>
<table class="class3" cellpadding="0" cellspacing="0" style="margin-top: 0px;">
<tr>
<td class="cell1">Cell9</td>
<td class="cell2">Cell10</td>
</tr>
<tr>
<td class="cell1">Cell11</td>
<td class="cell2">Cell12</td>
</tr>
</table>
</td>
<td>
<div class="mydiv">mydiv</div>
</td>
</tr>
</table>