I am new to using the Repeater as well as the Datalist.
I checked in the forum for the correct way to place a datalist inside a repeater. Below is what I created, but it is only displaying the header of the repeater when I run it
<div id="divMarketSnapshot" style="vertical-align: central; width: 100%; height: 450px; overflow: auto" runat="server">
<asp:Repeater ID="rptrRanks" runat="server" ViewStateMode="Disabled">
<HeaderTemplate>
<table border="0" style="border-collapse: collapse; table-layout: fixed; width:100%;vertical-align:central">
<tr style="height: 14pt; width:100%">
<td class="xl6220798" colspan="33" style="text-align: left; font-weight: bold;width:99.99%"></td>
</tr>
<tr style="height: 14pt; width:100%">
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" colspan="27" style="text-align: left;font-size:14pt; font-weight: bold;width:81.1%"><%# DataBinder.Eval(Container.DataItem, "EventRow_Group") %></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
<td class="xl1520798" style="width:3.03%"></td>
</tr>
<tr style="height: 14pt; width:100%">
<td class="xl6220798" colspan="33" style="text-align: left; font-weight: bold;width:99.99%"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<asp:DataList ID="dlRanks" runat="server" RepeatColumns="2" RepeatDirection="Horizontal">
<HeaderTemplate>
<tr style="height: 14pt; width:100%" runat="server">
<td runat="server" colspan="16" class="xl6620798" style="width:48.48%">
<%# DataBinder.Eval(Container.DataItem, "EventRow_Name") %>
</td>
<td class="xl1520798" style="width:3.03%"></td>
</tr>
<tr runat="server" style="width: 100%">
<td class="xl6720798" colspan="2" style="width: 6.06%; text-align: center">Date</td>
<td class="xl6720798" colspan="2" style="width: 6.06%; text-align: center">Market<br />Forecast</td>
<td class="xl6820798" colspan="2" style="width: 6.06%; text-align: center">RCG<br />Forecast</td>
<td class="xl6920798" colspan="2" style="width: 6.06%; text-align: center">Market<br />Actual</td>
<td class="xl7020798" colspan="2" style="width: 6.06%; text-align: center">RCG<br />Accuracy</td>
<td class="xl6920798" colspan="2" style="width: 6.06%; text-align: center">Equity Market<br />End Of Day</td>
<td class="xl7020798" colspan="2" style="width: 6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_IndexHeader") %> Index<br />End Of Day</td>
<td class="xl7020798" colspan="2" style="width: 6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_CurrencyHeader") %><br />End Of Day</td>
<td class="xl1520798" style="width: 3.03%"></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="width:100%">
<td class="xl7120798" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_DateTime") %></td>
<td class="xl7120798" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Forecast") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_ForecastDirection_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_ForecastDirection") %></td>
<td class="xl7120798" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Actuals") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_ActualMarketResult_Font") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_ActualMarketResult") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_Equity_EOD_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Equity_EOD_Price") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_Index_EOD_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Index_EOD_Price") %></td>
<td class="<%# DataBinder.Eval(Container.DataItem, "EventRow_Currency_EOD_Change") %>" colspan="2" style="width:6.06%; text-align: center"><%# DataBinder.Eval(Container.DataItem, "EventRow_Currency_EOD_Price") %></td>
<td class="xl1520798" style="width:3.03%"></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr style="width:100%">
<td style="width:3.03%"></td>
<td style="width:3.03%"></td>
<td class="xl1520798_15" colspan="4" style="width:12.12%; text-align: left">Next Forecast: <%# DataBinder.Eval(Container.DataItem, "EventRow_NextForecast") %></td>
<td style="width:3.03%"></td>
<td class="xl1520798_15" colspan="3" style="width:12.3%;text-align:center">Ultra Accuracy: <span style="<%# DataBinder.Eval(Container.DataItem, "EventRow_UltraAccuracy_Style") %>"><%# DataBinder.Eval(Container.DataItem, "EventRow_UltraAccuracy") %></td>
<td colspan="7" style="width:21.21%"></td>
</tr>
<tr style = "width:100%">
<td class="xl6820798" colspan="33" style="width:99.99%"></td>
</tr>
</FooterTemplate>
</asp:DataList>
</table>
</ItemTemplate>
Code-behind on ItemDatabound:
Private Sub rptrRanks_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles rptrRanks.ItemDataBound
Dim dt As DataTable
Dim dlRanks As DataList = DirectCast(e.Item.FindControl("dlRanks"), DataList)
dt = TryCast(rptrRanks.DataSource, DataTable)
dlRanks.DataSource = dt
dlRanks.DataBind()
End Sub
For the Datalist, I have 2 columns of data.
The structure that I am looking for is as follows:
Group
Event Event
data col data col data col data col data col data col
data col data col data col data col data col data col
data col data col data col data col data col data col
data col data col data col data col data col data col
Footer information Footer information
Please let me know what I need to change so that it works properly.
All, I found a link for doing Nested Repeaters. I am working with my code to get this correct. Here is the link https://www.mikesdotnetting.com/article/57/displaying-one-to-many-relationships-with-nested-repeaters
Related
I have a repeater but I know that what I've written will repeat the titles at the start of each row. I can't figure out how to update the layout so that the titles of Event, Target Day(s) and Performed Day appear vertically at the start of each row and its just the columns with the evaluated columns that repeat.
<div class="contentContainer">
<asp:HiddenField ID="hidColumnWidth" runat="server" />
<table class="dataTable fullWidth">
<tr>
<td>
<asp:Repeater ID="repTimedPathway" runat="server">
<HeaderTemplate>
<table class="fullWidth dataTable">
<tr>
<td><asp:Label runat="server" ID="lblTimedPathwayName" /></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td style='background-color:#00599B; color:white; font-size: 1.0em; border: solid 1px #000000; width: 15%;'>Event</td>
<td><%# System.Web.HttpUtility.HtmlEncode(Eval("EventTypeName")) %></td>
</tr>
<tr>
<td style='background-color:#00599B; color:white; font-size: 1.0em; border: solid 1px #000000;'>Target Day(s)</td>
<td><%#Eval("TargetDays") %></td>
</tr>
<tr>
<td style='background-color:#00599B; color:white; font-size: 1.0em; border: solid 1px #000000;'>Performed Day</td>
<td><%#Eval("PerformedDay") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table><br />
</FooterTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</div>
I have this repeater asp element:
<asp:Repeater ID="PervousResultsList" runat="server" EnableViewState="False" >
<ItemTemplate>
<div class="row1">
<table style="width: 100%">
<tr>
<td rowspan="4" onclick="parent.parent.ZoomToView(<%# Eval("Lon") %>, <%# Eval("Lat") %>, 2500)" style="cursor: pointer;">
<asp:Image ID="Image1" ImageUrl="~/Images/pushpinred.png" runat="server" Width="32"
Height="32" /></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td rowspan="10">
<asp:Image class="toggleRow" ImageUrl="~/Images/vertical-dots.png" runat="server" Width="32"
Height="32" Style="height: 30px; position: relative; float: left; cursor: pointer;" /></td>
</td>
</tr>
<tr class="pointDescArea">
<td>text:</td>
<td rowspan="2">
<h1 style="color: gray"><%# Eval("Text") %></h1>
</td>
</tr>
<tr class="hidden">
<td>X:</td>
<td><%# Eval("Lon") %></td>
</tr>
<tr class="hidden">
<td>Y:</td>
<td><%# Eval("Lat") %></td>
</tr>
<tr>
</table>
</div>
</ItemTemplate>
<AlternatingItemTemplate>
<div class="row2">
<table style="width: 100%">
<tr>
<td rowspan="4" onclick="parent.parent.ZoomToView(<%# Eval("Lon") %>, <%# Eval("Lat") %>, 2500)" style="cursor: pointer;">
<asp:Image ID="Image1" ImageUrl="~/Images/pushpinred.png" runat="server" Width="32"
Height="32" /></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td rowspan="10">
<asp:Image class="toggleRow" ImageUrl="~/Images/vertical-dots.png" runat="server" Width="32"
Height="32" Style="height: 30px; position: relative; float: left; cursor: pointer;" /></td>
</td>
</tr>
<tr class="pointDescArea">
<td>טקסט:</td>
<td rowspan="2">
<h1 style="color: gray"><%# Eval("Text") %></h1>
</td>
</tr>
<tr class="hidden">
<td>X:</td>
<td><%# Eval("Lon") %></td>
</tr>
<tr class="hidden">
<td>Y:</td>
<td><%# Eval("Lat") %></td>
</tr>
</tr>
</table>
</div>
</AlternatingItemTemplate>
</asp:Repeater>
I need to set it's height to 500px and make scrollable.
How can I make this repeater scrollable vertically?
Put the repeater inside a div, set the div's height and use overflow-y
<div style="height: 500px; overflow-y: scroll;">
<asp:Repeater ID="PervousResultsList" runat="server" EnableViewState="False" >
...
</asp:Repeater>
</div>
Ideally the styling should be in style tags or in a stylesheet, but I'm showing it inline just for demonstration.
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>
Here I have a table row in a listview declared as follows:
<tr onclick="<%= _jsPostBackCall %>;" />
I am calling a postback method on the backend but must get the tr index:
public void RaisePostBackEvent(string eventArgument)
{
//selected index here
}
aspx page content - below is the html in the aspx page. This contains the listview.
<asp:ListView ID="lvEquipmentList" runat="server" OnSelectedIndexChanged="lvEquipmentList_SelectedIndexChanged" OnSelectedIndexChanging="lvEquipmentList_SelectedIndexChanging">
<LayoutTemplate>
<table runat="server" class="TableCSS">
<tr runat="server" class="TableHeader">
<td runat="server" style="width: 30%;">PRODUCT LINE</td>
<td runat="server" style="width: 20%;">MODEL</td>
<td runat="server" style="width: 20%;">SERIAL #</td>
<td runat="server" style="width: 12%; text-align:center">DAR STATUS</td>
<td runat="server" style="width: 18%; text-align:right;">SHIP DATE</td>
</tr>
<tr id="ItemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<EmptyDataTemplate>
<table id="Table1" runat="server" class="TableCSS">
<tr runat="server" class="TableHeader">
<td id="Td1" runat="server" style="width: 30%;">PRODUCT LINE</td>
<td id="Td2" runat="server" style="width: 20%;">MODEL</td>
<td id="Td3" runat="server" style="width: 20%;">SERIAL #</td>
<td id="Td4" runat="server" style="width: 12%; text-align:center;">DAR STATUS</td>
<td id="Td5" runat="server" style="width: 18%; text-align:right;">SHIP DATE</td>
</tr>
<tr runat="server" class="TableData">
<td style="column-span:all;">
<asp:Label runat="server" Text="There are no reports to display."></asp:Label>
</td>
</tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr style="border-bottom:1pt solid #E2E2E8;" onclick="<%= _jsPostBackCall %>;" onmouseover="this.style.background='#f6f6f6';" onmouseout="this.style.background='white'">
<td style="width: 30%; padding: 0px 15px 0px 15px;">
<table>
<tr class="NoBorder">
<td style="width: 20%;">
<img src='<%#Eval("standard_image") %>' alt="" width="80" onerror="this.src='Content/Images/placeholder.png';"/>
</td>
<td>
<asp:Label ID="lblProductLine" runat="server" Text='<%#Eval("product_line")%>'/>
</td>
</tr>
</table>
</td>
<td style="width: 24%; padding: 0px 15px 0px 15px;">
<asp:Label ID="lblModelNum" runat="server" Text='<%#Eval("model")%>'/>
</td>
<td style="width: 16%; padding: 0px 15px 0px 15px;">
<asp:Label ID="lblSerialNum" runat="server" Text='<%#Eval("serial_number")%>'/>
</td>
<td style="width: 12%; padding: 0px 15px 0px 15px; text-align:center;">
<asp:LinkButton runat="server" ID="SelectCategoryButton" CommandName="Select">
<img id="Img1" runat="server" src='<%#Eval("display_status") %>' alt="" width="20"/>
</asp:LinkButton>
</td>
<td style="width: 18%; padding: 0px 15px 0px 15px; text-align:right;">
<asp:Label ID="lblShipDate" runat="server" Text='<%#Eval("date")%>'/>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
When registering postback call - second argument will be the parameter:
_jsPostBackCall = ClientScript.GetPostBackEventReference(this, "The Parameter");
i've a 'structure' on a Asp.Net ListView like this (it is an exctract):
<asp:ListView ID="lvSchede" runat="server" DataSourceID="dsWrkCtrTable" GroupItemCount="1">
<GroupTemplate>
<tr id="itemPlaceholderContainer" runat="server">
<td id="itemPlaceholder" runat="server" style="width: 100%">
</td>
</tr>
</GroupTemplate>
<ItemTemplate>
<td id="Td2" runat="server" style="vertical-align: top;">
<table style="background-color: #EEDFCC; padding: 10px 10px 10px 10px; border-style: solid;
border-width: 1px; border-color: Gray;">
<tr>
<td>
......
......
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="groupPlaceholderContainer" runat="server" border="0" style="background-color: #FFFFFF;
border-color: #999999; border-style: none; font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr id="groupPlaceholder" runat="server" style="padding: 20px 20px 20px 20px;">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="text-align: center; background-color: #CCCCCC; font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000000;">
</td>
</tr>
</table>
</LayoutTemplate>
The problem is that my output are columns with different size (follow the image, i've manually deleted string content for my company's privacy):
Where i've to set the column size to have it ALL the same ?
Thanks
Here's an example of how to set column width inside a table with 1 column:
<table border="1" width="100%">
<col width="100">
<tr>
<th>Month</th>
</tr>
<tr>
<td>January</td>
</tr>
<tr>
<td>February</td>
</tr>
</table>
This is an example with 2 columns:
<table border="1" width="100%">
<col width="100">
<col width="50">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
This is an example with 3 columns:
<table border="1" width="100%">
<col width="40">
<col width="40">
<col width="20">
<tr>
<th>Month</th>
<th>Savings</th>
<th>Loans</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
<td>$10</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
<td>$8</td>
</tr>
</table>
Hope this helps out at least a bit.