Repeater Control Problem...

Discussion in 'ASP .Net' started by Z D, May 19, 2004.

  1. Z D

    Z D Guest

    Hello,

    I'm using a repeater control and I wish to put some logic in when accessing
    one of the columns.

    If I use this syntax, I'm able to output the column with no problem:
    <%# (Container.DataItem("Quantity")) %>


    But now I wish to put some logic around this, so, first I tried the
    following:
    <% Response.Write(Container.DataItem("HomeProfileNrgEquipQtyElectric")) %>

    This gives the following error:
    BC30451: Name 'Container' is not declared.



    Does anybody have any idea what I'm doing wrong? Eventually, instead of
    using the Response.Write, I'll be putting an IF statement in there. Why
    cant I access the "container" in this fashion?

    I'm assuming it's just my syntax.... ?


    Thanks in advance :)
    -ZD
     
    Z D, May 19, 2004
    #1
    1. Advertising

  2. Z D

    Z D Guest

    CORRECTION

    Sorry, the second peice of code should have been:
    <% Response.Write(Container.DataItem("Quantity")) %>

    I still get the same error, it was just a typo in my original post. Any
    thoughts?

    -ZD


    "Z D" <> wrote in message
    news:...
    > Hello,
    >
    > I'm using a repeater control and I wish to put some logic in when

    accessing
    > one of the columns.
    >
    > If I use this syntax, I'm able to output the column with no problem:
    > <%# (Container.DataItem("Quantity")) %>
    >
    >
    > But now I wish to put some logic around this, so, first I tried the
    > following:
    > <% Response.Write(Container.DataItem("HomeProfileNrgEquipQtyElectric")) %>
    >
    > This gives the following error:
    > BC30451: Name 'Container' is not declared.
    >
    >
    >
    > Does anybody have any idea what I'm doing wrong? Eventually, instead of
    > using the Response.Write, I'll be putting an IF statement in there. Why
    > cant I access the "container" in this fashion?
    >
    > I'm assuming it's just my syntax.... ?
    >
    >
    > Thanks in advance :)
    > -ZD
    >
    >
     
    Z D, May 19, 2004
    #2
    1. Advertising

  3. Z D

    Z D Guest

    Hi Bin,

    Thaks for your reply.

    I'm not sure that I can put the code in the ItemDataBound event because I
    need to output (response.write) some HTML on the .aspx page at exactly a
    certain spot depending on the value of a specific data item.

    Is this possible?

    thanks!
    -ZD

    "Bin Song, MCP" <> wrote in message
    news:...
    > Hi,
    >
    > <%#Container.DataItem ...%> is only for simple data binding. If you want

    to include some logic, write the code in the Repeater.ItemDataBound Event.
    Please see:
    >

    http://msdn.microsoft.com/library/d...ebcontrolsrepeaterclassitemdataboundtopic.asp
    >
    > Bin Song, MCP
     
    Z D, May 20, 2004
    #3
  4. =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=, May 20, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    877
  2. Replies:
    0
    Views:
    2,904
  3. Replies:
    1
    Views:
    7,048
    Karl Seguin
    Aug 10, 2005
  4. uncensored
    Replies:
    0
    Views:
    830
    uncensored
    Oct 25, 2006
  5. Microsoft

    Repeater inside a Repeater

    Microsoft, Aug 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    214
    Microsoft
    Aug 21, 2006
Loading...

Share This Page