Note that there are some explanatory texts on larger screens.

plurals
  1. PONested Repeaters
    primarykey
    data
    text
    <p>i am having some trouble with repeaters each. i am trying to repeat a list of appliances under a unique categories from my database. the category names repeat allright but the appliance names repeat for all the categories(meaning all categories have the same appliances) i used a nested repeater for the appliances i do not know if that is the problem.</p> <pre><code> &lt;%@ Page Title="" Language="VB" MasterPageFile="~/public.master" AutoEventWireup="false" CodeFile="ccalc.aspx.vb" Inherits="ccalc" %&gt; &lt;%@ Import Namespace="System.Data" %&gt; &lt;%@ Import Namespace="System.Data.OleDb" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"&gt; &lt;div&gt; &lt;h1&gt;Estimated Monthly Electricity Consumption Calculator&lt;/h1&gt; &lt;/div&gt; &lt;div&gt; &lt;asp:Repeater ID="myRepeater" runat="server"&gt; &lt;ItemTemplate&gt; &lt;table width="100%" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF" class="ten"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td colspan="5"&gt;&lt;h2&gt; &lt;asp:Label ID="catid" runat="server" Text='&lt;%#Eval("CategoryID") %&gt;'&gt;&lt;/asp:Label&gt; &lt;asp:Label ID="Catname" runat="server" Text='&lt;%#Eval ("CategoryName") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/h2&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr align="center"&gt; &lt;th class="style1" bgcolor="#FFCC66"&gt;Electrically Powered Items&lt;/th&gt; &lt;th class="ten" bgcolor="#FFCC66"&gt;&lt;div align="center"&gt;Quantity&lt;/div&gt;&lt;/th&gt; &lt;th class="ten" bgcolor="#FFCC66"&gt;&lt;div align="center"&gt;Average monthly KWh&lt;/div&gt;&lt;/th&gt; &lt;th class="ten" bgcolor="#FFCC66"&gt;&lt;div align="center"&gt;KWh/month&lt;/div&gt;&lt;/th&gt; &lt;th class="ten" bgcolor="#FFCC66"&gt;&lt;div align="center"&gt;GHc /month&lt;/div&gt;&lt;/th&gt; &lt;/tr&gt; &lt;asp:Repeater ID="innerRepeater" runat="server" DataSource = &lt;%# sqldatasource3%&gt; &gt; &lt;ItemTemplate &gt; &lt;tr&gt; &lt;td class="style1"&gt;&lt;strong&gt; &lt;asp:Label ID="appName" runat="server" Text='&lt;%#Eval ("ApplianceName") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/strong&gt;&lt;/td&gt; &lt;td class="highlight"&gt;&lt;div align="center"&gt; &lt;asp:TextBox ID="quantity" runat="server" AutoPostBack="True" CssClass="input" Width="79px" &gt;&lt;/asp:TextBox&gt; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;div align="center"&gt; &lt;input name="refrigeratorMonthKWh" value="182" type="hidden" /&gt; &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;div align="center"&gt; &amp;nbsp;&lt;asp:TextBox ID="kwh" runat="server" CssClass="input4" Width="59px"&gt;&lt;/asp:TextBox&gt; &lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;div align="center"&gt; &amp;nbsp;&lt;asp:TextBox ID="ghc" runat="server" CssClass="input4" Width="59px"&gt;&lt;/asp:TextBox&gt; &lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;% 'End While 'brb.Dispose() 'br.Close() %&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;% 'End While 'cmd.Dispose() 'dr.Close() %&gt; &lt;/div&gt; &lt;% %&gt; &lt;div&gt; &lt;table width="100%" border="0" cellpadding="5" bgcolor="#FFF7E5" class="ten"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;font color="#9f7f40"&gt;Estimated&lt;/font&gt; monthly &lt;u&gt;&lt;font color="#FF0000"&gt;household &lt;/font&gt;&lt;/u&gt;* usage: &lt;asp:TextBox ID="totalusage" runat="server" CssClass="input4" Width="59px"&gt;&lt;/asp:TextBox&gt; &amp;nbsp;kWh; &lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="highlight"&gt;&lt;font color="#9f7f40"&gt;Estimated&lt;/font&gt; monthly &lt;u&gt;&lt;font color="#FF0000"&gt;household&lt;/font&gt;&lt;/u&gt;* bill: &amp;cent; &lt;asp:TextBox ID="totalbill" runat="server" CssClass="input4" Width="59px"&gt;&lt;/asp:TextBox&gt; &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnectionString2 %&gt;" ProviderName="&lt;%$ ConnectionStrings:ConnectionString2.ProviderName %&gt;" SelectCommand="SELECT * FROM [DeviceCategory]"&gt;&lt;/asp:SqlDataSource&gt; &lt;asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnectionString2 %&gt;" ProviderName="&lt;%$ ConnectionStrings:ConnectionString2.ProviderName %&gt;" SelectCommand="SELECT * FROM [Appliances] where ([CategoryID]=[CategoryID])"&gt; &lt;%--&lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID=myRepeater.innerrepeater.catid Name="catid" PropertyName="Text" Type="String" /&gt; &lt;/SelectParameters&gt;--%&gt; &lt;/asp:SqlDataSource&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="highlight"&gt;&lt;h3&gt;&lt;strong&gt;&lt;em&gt;*Heating usage not included in household totals&lt;/em&gt;&lt;/strong&gt;&lt;/h3&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt; &lt;/asp:Content&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload