Re: Use a label in a FooterTemplate control? Surely, there must be a way...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Well, I haven't seen your entire code, but if you go to your code you should
see a section near the top inside the "Web Form Designer Generated Code"
region where all the Controls on the page are declared. Most (if not all) of
these will look like the following:


Protected WithEvents yourcontrolid As System.Web.UI.WebControls.HyperLink


If Visual Studio didn't add your Label to this list for you, you can add it
yourself, yours would look like the following:


Protected WithEvents lblTotalCapitalBudgets As
System.Web.UI.WebControls.Label


Something else I want to point out to you is that your quotes are mismatched
in the Text attribute. Try changing the Text attribute to look like the
following:


Text='<%#GetTotal(Container.DataItem("ParentRecordID")%>'


Notice that the outer quotes are single quotes (') and the inner quotes are
double quotes ("). It is also a good idea and more efficient to get the sum
using SQL code rather than the ASP.NET code, if you need to know how to do
this let me know and I will be happy to help you. Good Luck!
--
Nathan Sokalski
njsokalski@xxxxxxxxxxx
http://www.nathansokalski.com/

"Groove" <noway@xxxxxxxxxxx> wrote in message
news:udU8%23ONhGHA.1864@xxxxxxxxxxxxxxxxxxxxxxx
I have a typical Repeater that contains a Template (html table). The
repeater / template lists many records and in the footer, I'd like to
simply SUM up the $$ amounts from all the records in the repeater. Easy
enough.

So I tried to place a Label control in the footer and fill the Text of the
label from code. I get the label is not declared error. So how can I go
about doing this? I tried writing a helper function in the code-behind
file to get the value to place in the label but can't seem to get it work.

Any ideas? Thanks in advance!

(ASP.NET 2/VB)

<FooterTemplate>
<tr valign="top">
<td colspan="2" align="right" class="ColumnHeader">Total</td>
<td class="ColumnHeader" width="25%"><asp:Label
ID="lblTotalCapitalBudgets" runat="server" Font-Bold="true"
Text="<%#GetTotal(Container.DataItem("ParentRecordID")%>" /></td>
</tr>
</table>
</FooterTemplate>



Protected Function GetTotal(intRecordID As Integer) As String

..typical function to run a SQL Statement to get a SUM..

End Function





Compiler Error Message: BC30451: Name 'lblTotalCapitalBudgets' is not
declared.





.



Relevant Pages

  • Use a label in a FooterTemplate control? Surely, there must be a way...
    ... I have a typical Repeater that contains a Template. ... SUM up the $$ amounts from all the records in the repeater. ... So I tried to place a Label control in the footer and fill the Text of the ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: expand and retract form procedure
    ... "Steve Sanford" wrote: ... In the form footer, ... In design view, for all the text boxes and labels, set the top at 0.05". ... 'attached label for Text17 ...
    (microsoft.public.access.forms)
  • Re: Block Cipher Endedness
    ... The basic goals of the current limited series include generally all ... maximum Pt sum value is divided by the maximum Ct sum value, ... all common keyboard characters throughout the series. ... sequential single quotes to reduce the character set. ...
    (sci.crypt)
  • Re: how to insert custom footer as part of firing print command
    ... >As part of information security policy, it is mandatory to label each ... >document about its level of confidentiality. ... >However, a normal user often forgets to label, creating problems during ... >button) that gets automatically inserted as footer in the printed document. ...
    (microsoft.public.word.docmanagement)
  • Re: Label does not show below a text box with a Can Grow property
    ... > some text below this in the page footer section. ... > in the label starts. ... >> This probably happens because Page Header sections can't grow. ... >> Duane Hookom ...
    (microsoft.public.access.reports)