I have the following Repeater and I am trying to add a divider (dotted line or similar) after each row but the style is getting messed up, what am I doing wrong?
Code:
<ItemTemplate>
<table id="tableItem" runat="server">
<tr>
<td style="width:400px;">
<%-- <asp:Label ID="lblEmployeeId" runat="server" Text='<%#Eval("EmployeeId") %>' ></asp:Label>--%>
<asp:HiddenField ID="HdnEmployeeId" runat="server" Value='<%#Eval("EmployeeId") %>' />
<asp:Literal Text="" runat="server" ID="LiteralUser" ></asp:Literal>
</td>
</tr>
<tr>
<td style="width: 100px;">
<asp:HiddenField ID="HdnRequestId" runat="server" Value='<%#Eval("id") %>' />
<asp:Label ID="lblDate" runat="server" Text='<%#Eval("Date", "{0:dd/M/yyyy}") %>'></asp:Label>
</td>
<td style="width: 80px;">
<asp:Label ID="lblHours" runat="server" Text='<%#Eval("Hours") %>'></asp:Label>
</td>
<td style="width: 50px; font-size:10px;">
<asp:Label ID="lblPeriod" runat="server" Text='<%#Eval("AMorPM") %>'></asp:Label>
</td>
<td style="width: 850px; font-size:10px;">
<asp:Label ID="lblNote" runat="server" Text='<%#Eval("Note") %>'></asp:Label>
</td>
<td style="50px">
<asp:RadioButtonList ID="rbtVerified" runat="server" >
<asp:ListItem Value="1">Accept</asp:ListItem>
<asp:ListItem Value="2">Reject</asp:ListItem>
</asp:RadioButtonList>
</td>
<td>
<asp:TextBox ID="txtNotes" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td style="width:900px;">
<asp:Label ID="lblBreak" runat="server" Text="------------------------------------------------------------------------------"></asp:Label>
</td>
</tr>
</table>
By Style getting messed up I mean the dotted line is being displayed only under the first column (lblDate) and the lblDate width is expanded.
you can use a separator template and inside it insert <hr />
<asp:Repeater runat="server" ID="rp">
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:Repeater>
Since your middle TR has 6 TDs, add attribute colspan="6" to TD in the 1st and the last row
<td colspan="6" style="width:400px;">
...
<td colspan="6" style="width:900px;">
By the way, you're specifying different width for the 1st and the last TD and both are less than summary width of inner TDs, so those styles won't have any effect and can be removed.
Another approach would be to spit out a div at the very end of your template and change its border to dotted. I tend to use this approach quiet often as it gives me the ability to easily add space between each item by targeting the div and adding margin around it.
So something like this:
<ItemTemplate>
...
<div class="divider"></div>
</ItemTemplate>
.divider
{
border: 1px dotted #C5C5C5;
height: 5px;
margin-bottom: 15px;
width: 100%;
}
Another way to do that just with with css flex
<div style="display: flex; align-items: center">
<div>My awesome article price:</div>
<div style="flex:1;border-bottom: dotted 1px #eee"></div>
<div>10.00€</div>
</div>
Related
I have an asp update panel that contains a repeater with items bound to a dataset showing the names of tables on which a particular sql query is about to run. For each item in the repeater I also show the status of the query (Waiting/Running/Completed), when the query started, and when the query finished.
When the user presses a run button, each table is queried in turn, and the status/start time/end time are all updated to give the user feedback as to where the queries are up to. This is all achieved using asp:timer and asp:AsyncPostBackTrigger. As each query finishes a "data preview" button is also unhidden that opens an ajax modal popup box to show the data extracted.
My issue is that if a user presses the data preview button whilst the timer is still running, the popup opens and then immediately closes. Once all queries have finished and the timer is closed, all is fine - but I would like the user to be able to able to preview the results of each query at the point they finish.
I have found on other forums the suggestion to move the modal popup box out of the update panel, but then I can't find a way to link the repeater buttons to the popup controls.
Any ideas?
ASPX page extract:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Timer runat="server" ID="Timer1" Interval="1000" Enabled="false" ontick="Timer1_Tick" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:ImageButton ID="Export" ImageUrl='/Stock/Some.png' runat="server" Enabled="False" Visible="False" />
<br />
<br />
<asp:Repeater ID="rptTbl" runat="server">
<HeaderTemplate>
<h3>Querying Tables:</h3>
<table id="Tbls" class="table">
<tr>
<td width="40%" style="border-right: 1px solid #494444; border-bottom: 1px solid #494444" >
<b>Table Name</b>
</td>
<td width="20%" style="border-right: 1px solid #494444; border-bottom: 1px solid #494444" >
<b>Status</b>
</td>
<td width="15%" style="border-right: 1px solid #494444; border-bottom: 1px solid #494444" >
<b>Query Start</b>
</td>
<td width="15%" style="border-right: 1px solid #494444; border-bottom: 1px solid #494444" >
<b>Query End</b>
</td>
<td width="10%" style="border-bottom: 1px solid #494444" >
<b>Preview Data</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style="border-right: 1px solid #494444;">
<asp:Label ID="TblData" runat="server" Text='<%# Eval("table_name") %>'></asp:Label>
</td>
<td style="border-right: 1px solid #494444;">
<asp:Image ID="LoadingImg" runat="server" ImageUrl="~/Stock/Spinner.gif" Visible="False" Height="20px" /><asp:Label ID="LoadingLabel" runat="server" Text='Please Wait...'></asp:Label>
</td>
<td style="border-right: 1px solid #494444;">
<asp:Label ID="lblQuerySart" runat="server" Text=''></asp:Label>
</td>
<td style="border-right: 1px solid #494444;">
<asp:Label ID="lblQueryEnd" runat="server" Text=''></asp:Label>
</td>
<td>
<asp:ImageButton ID="BtnViewData" runat="server" AlternateText="Preview Data..." OnCommand="BtnViewData_Click" CommandArgument='<%# Eval("table_name") %>' CausesValidation="False" BorderStyle="Solid" BorderWidth="1px" ImageAlign="AbsMiddle" Height="20px" ImageUrl="~/Stock/Some.png" Visible="False" Enabled="False" />
<ajaxToolkit:modalpopupextender
id="MPE_ShowData" runat="server"
cancelcontrolid="ButtonDeleteCancel" okcontrolid="ButtonDeleleOkay"
targetcontrolid="BtnViewData" popupcontrolid="DivShowData"
backgroundcssclass="ModalPopupBG">
</ajaxToolkit:modalpopupextender>
<ajaxToolkit:confirmbuttonextender id="CBE_ShowData"
runat="server" targetcontrolid="BtnViewData" enabled="True"
displaymodalpopupid="MPE_ShowData">
</ajaxToolkit:confirmbuttonextender>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<br>
</br>
</ContentTemplate>
</asp:UpdatePanel>
<asp:panel class="popupConfirmation" id="DivShowData"
style="display: none" runat="server" ScrollBars="Auto" Height="70%" Width="70%" BackColor="Gray">
<div class="popup_Container">
<div class="popup_Titlebar" id="PopupHeader">
<div class="TitlebarLeft">
Show The Data</div>
<div class="TitlebarRight" onclick="$get('ButtonDeleteCancel').click();">
</div>
</div>
<div class="popup_Body">
<p>
This is where the data appears!
</p>
</div>
<div class="popup_Buttons">
<input id="ButtonDeleleOkay" type="button" value="Okay" />
<input id="ButtonDeleteCancel" type="button" value="Cancel" />
</div>
</div>
</asp:panel>
I am working on my first Mobile Site using bootstrap. I am trying to create a Listview that is responsive, I made some research and I need to select Layout= Flow but my issue is that this layout flows from top to bottom (one column). I need to be able to display it from left to right up to 4 items, but I can't make it work.
code
<asp:ListView ID="ProductsListView" DataSourceID="SqlDataSource1" runat="server" DataKeyNames="ID">
<LayoutTemplate >
<div ID="itemPlaceholderContainer" runat="server" style="">
<span runat="server" id="itemPlaceholder" />
</div>
<div style="">
</div>
</LayoutTemplate>
<ItemTemplate>
<span style="">ID:
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
</span>
</ItemTemplate>
</asp:ListView>
It looks like you are having the same problem as this user.
horizontal list view in asp.net
The LayoutTemplate contains a block level element (the div). This means that the ItemTemplate will be wrapped in the div which will take up the full available width.
You should be able to just remove div from the LayoutTemplate, make it a span, or make it a table like in the Selected Answer of the post I linked from #mshsayem
If you just want to show the images in a single row, you can just put
them in the columns of a single row. Try rewriting the listview markup
as follows (move table,tr markups into LayoutTemplate):
<asp:ListView runat="server" ID="PageHorizon">
<LayoutTemplate>
<table>
<tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<td>
<img src='<%#Eval("ImagePath")%>' alt="Single Image"
width="64px" height="64px" />
</td>
</ItemTemplate>
</asp:ListView>
The script below displays the Listview item with layout = flow horizontally and it is responsive. I hope someone find it useful.
<div style=" text-align: center;">
<!-- start listview-->
<asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource1">
<LayoutTemplate >
<div ID="itemPlaceholderContainer" runat="server" >
<span runat="server" id="itemPlaceholder" />
</div>
</LayoutTemplate>
<EmptyDataTemplate>
<span>No data was returned.</span>
</EmptyDataTemplate>
<ItemTemplate>
<table style="display: inline-block;" >
<tr >
<td colspan="3">
<asp:Image ID="Image1" runat="server" Height="200px"
ImageUrl='<%# Eval("Picture") %>' Width="150px" />
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<span style="background-color: #FFFBD6;color: #333333;">
<asp:Label ID="OrderOfferNameLabel" runat="server"
Text='<%# Eval("WHATEVER") %>'></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<span style="background-color: #FFFBD6;color: #333333;">
<asp:Label ID="ProductNameLabel" runat="server"
Text='<%# Eval("WHATEVER") %>'></asp:Label>
</span>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="Button1" runat="server" Height="44px"
style="height: 26px; width: 56px" Text="Button" Width="380px" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:ListView>
</div>
Using the code below i am trying to page break after every two rows of my list view control
when my apsx page is genrated to a PDF page...But some how its not working ..can someone please check what i am doing wrong here or suggest any other method to achieve it
<asp:ListView ID="ListView1" runat="server"
DataSourceID="DS_DvtImages" GroupItemCount="2">
<ItemTemplate>
<td id="Td1" runat="server" class='<%# ((ListViewDataItem)Container).DisplayIndex % 2 == 0 ? "page-break-before: always" : "" %>' style="color: #333333; border-style:solid;" >
<asp:Image ID="Image1" runat="server" ImageUrl='<%# "~/ImageHandler.ashx?MaxHeight=500&MaxWidth=500&AttachmentId=" + Eval("ATTACHMENTID") %>' Height="300px" Width="300px" />
<br />
<span style="width:300px; background-color:Gray">
<asp:Label ID="Label1" runat="server" Text='<%# Eval("ATT_name") %>'
Font-Size="10pt" ForeColor="Black" Width="100%" />
</span>
</td>
</ItemTemplate>
<LayoutTemplate>
<table id="Table1" runat="server" class="ListViewMainTable">
<tr id="Tr1" runat="server">
<td id="Td2" runat="server">
<table ID="groupPlaceholderContainer" runat="server" border="1"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr ID="groupPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="Tr2" runat="server">
</tr>
</table>
</LayoutTemplate>
<GroupTemplate>
<tr ID="itemPlaceholderContainer" runat="server">
<td ID="itemPlaceholder" runat="server">
</td>
</tr>
</GroupTemplate>
</asp:ListView>
page-break-before: always is the style, not the class. You will have to create a class with the style as page-break-before: always and then reference that class
I have a list view on a page and am trying emulate the toggling effect of a tree view. When first bound the detail elements (LBL_ActionTitle, LBL_Action, LBL_UrlTitle, LBL_Url) are set to visibility = false. I would like to have the click event of the element (LB_ExpandCollapse) toggle the visibility of detail elements directly related to it. IE not all the elements of that type on the page. I am not sure how to accomplish this, or if it can be done, and was hoping that someone could point me in the right direction. Here is the control for reference.
<div id="logContainer">
<asp:ListView ID=LV_Logs runat="server">
<LayoutTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
<tr>
<td></td>
<td style="width:85%" />
</tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<hr />
<asp:LinkButton ID="LB_ExpandCollapse" runat="server" CausesValidation="false" OnClick="expandCollapse_Click">+</asp:LinkButton>
<asp:Label ID="LBL_MessageType" runat="server" Text='<%# Eval("messageType") %>'></asp:Label>
<hr />
</td>
<td style="text-align: right">
<hr />
<asp:Label ID="LBL_Message" runat="server" Text='<%# Eval("messageTime") %>'></asp:Label>
<hr />
</td>
</tr>
<tr style="text-align: left">
<td style="padding-left: 65px">
<asp:Label ID="LBL_ActionTitle" Visibility="false" runat="server" Text="User Action:"></asp:Label>
</td>
<td style="padding-left: 10px">
<asp:Label ID="LBL_Action" Visibility="false" runat="server" Text='<%# Eval("action") %>'></asp:Label>
</td>
</tr>
<tr style="text-align: left">
<td style="padding-left: 65px">
<asp:Label ID="LBL_UrlTitle" Visibility="false" runat="server" Text="URL:"></asp:Label>
</td>
<td style="padding-left: 10px">
<asp:Label ID="LBL_Url" runat="server" Visibility="false" Text='<%# Eval("url") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:DataPager ID="DataPagerProducts" runat="server" PagedControlID="LV_Logs"
PageSize="20" OnPreRender="DataPagerProducts_PreRender">
<Fields>
<asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
I suggest you put the ID of the record as an ID on the TR containing the fields you want toggled. Then in your expandCollapseClick also pass the ID, so that you can set the row's style to display:block. Of course this assumes that all the rows start out at display:none. ie.
<tr id='<%# Eval("recordId") %>' style='display:none'>
and then in Javascript (pseudo-code)
function expandCollapseClick(row)
{
document.getElementById(row).style.display = 'block';
}
Then change your button to execute client-side as in:
<button onclick='expandCollapse(<%# Eval("recordId") %>)'>+</button>
This will call the code to display the row, passing in the id of the correct row. Of course this assumes that the table is fully populated when the page is retrieved and all you want to do is hide/show detail.
i am trying to vertically align the table present in the panel but i cant and when i apply style properties to the table it does not work ? means there would be no effect of style property on it as my code is given below,
<asp:Panel ID="Panel1" runat="server"
style="z-index:0;left:250px;position:absolute;top:160px; height: 160px; padding:10"
BackColor="Green" Width="300px">
<div style="width: 295px; height: 155px;" align= "center">
<table style="height: 48px; width: 187px; margin-left:0px; min-height:14px; min-width:55px; vertical-align:bottom" align="center" bgcolor="green" >
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="UserName" ForeColor="White"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Password" ForeColor="White"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" textmode="Password" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" ForeColor="White"></asp:Label>
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Login" onclick="Button1_Click" />
</td>
</tr>
</table>
</div>
</asp:Panel>
Hopes for your suggestions
Vertical alignment of some content within parent container is always tricky if you don't know the height of the content. Solution is to have a wrapper div in between parent & content elements. Then have outer container with "display:table" and wrapper div with "display:table-cell" aligned vertically in middle. See this fiddle for the illustration: http://jsfiddle.net/myXL3/3/
For complete information on this approach, see this excellent article: http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
The problem here is that you have the table within a div element. Adding vertical-align:middle to the div's style should work. This assumes that the div is always "higher" than the table (as in your code snippet).
(Also, you have margins in your table's style - they should be removed to make sure they are not interfering with the vertical alignment)