1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Data Item in asp.net

Discussion in 'C#' started by lovelyhelp, Feb 14, 2006.

  1. #1
    i found an compilation errors with the code as below. I am using asp.net framework 2.0 in vb language:
    'DataItem' is not a member of 'System.Web.UI.Page'
    How to proceed?
    -----------------------------------------------------------------

    <asp:repeater ID="rptLinks1" runat="Server">

    <ItemTemplate>
    <table>
    <tr>
    <td><%# container.DataItem("tutorial_chapter") %></td>
    </tr>
    <tr>
    <td><asp:HyperLink ID="HyperLink4" runat="server" Text='<%# container.DataItem("tutorial_subject") %>' NavigateUrl='<%# container.DataItem("tutorial_hyperlink") %>'></asp:HyperLink></td>
    </tr>
    </table>

    </itemtemplate>
    </asp:repeater>
    SEMrush
    </td>
    <td style="width: 293px"><asp:Label runat="server" Text='<%# Container.DataItem("tut_text") %>' ID="lblTextDesc" Height="271px" Width="278px" /></td>
    <td><asp:Image ID="imgSwf" runat="server" Height="273px" ImageAlign="Right" ImageUrl='<%#Container.DataItem("tut_image")%>' Width="214px" /></td>
     
    lovelyhelp, Feb 14, 2006 IP
    SEMrush
  2. SEO Jeff

    SEO Jeff Active Member

    Messages:
    534
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    90
    #2
    I believe your missing the eval part in your HTML code

    something like this should work

    <a href="<%# DataBinder.Eval(Container.DataItem, "URL") %>">
    <%# DataBinder.Eval(Container.DataItem, "Name") %></a>
     
    SEO Jeff, Feb 19, 2006 IP
  3. IndiaNets

    IndiaNets Guest

    Best Answers:
    0
    #3
    Get confused. Sorry!
     
    IndiaNets, Feb 11, 2008 IP
  4. freestate

    freestate Well-Known Member

    Messages:
    975
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    160
    #4
    I'm having a similar problem - did this fix it in the end?
     
    freestate, Mar 14, 2008 IP
  5. baybossplaya

    baybossplaya Active Member

    Messages:
    597
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #5
    try Container.DataItem instead of container.DataItem
     
    baybossplaya, Apr 6, 2008 IP
  6. locdev

    locdev Active Member

    Messages:
    171
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #6
    you are using <%# Container.DataItem("tut_text") %> out of repeater item template
    that's why it can't find the property "Container"
    
    <asp:repeater ID="rptLinks1" runat="Server">
    
    <ItemTemplate> 
    <table>
    <tr>
    <td><%# container.DataItem("tutorial_chapter") %></td>
    </tr>
    <tr>
    <td><asp:HyperLink ID="HyperLink4" runat="server" Text='<%# container.DataItem("tutorial_subject") %>' NavigateUrl='<%# container.DataItem("tutorial_hyperlink") %>'></asp:HyperLink></td>
    </tr>
    </table>
    
    </itemtemplate>
    </asp:repeater> 
    
    </td>
    <td style="width: 293px">
    
    Problem IS here -->
    <asp:Label runat="server" Text='<%# Container.DataItem("tut_text") %>' ID="lblTextDesc" Height="271px" Width="278px" /></td>
    <td>
    
    and here -->
    <asp:Image ID="imgSwf" runat="server" Height="273px" ImageAlign="Right" ImageUrl='<%#Container.DataItem("tut_image")%>' Width="214px" /></td>
    
    Code (markup):
     
    locdev, Apr 8, 2008 IP
  7. peacenlove

    peacenlove Banned

    Messages:
    206
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Container.DataItem instead of container.DataItem is right answer.
     
    peacenlove, Apr 28, 2008 IP
  8. kineticdc

    kineticdc Peon

    Messages:
    347
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks for the information
     
    kineticdc, May 26, 2008 IP
  9. MoneyMoose

    MoneyMoose Peon

    Messages:
    683
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Same thing happened to me - thanks for the info.
     
    MoneyMoose, Jun 17, 2008 IP
  10. quintin671

    quintin671 Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    To many of us have the same stupid problem.
     
    quintin671, Jun 26, 2008 IP
  11. Sleeping Troll

    Sleeping Troll Peon

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Yeah, tough on us ASP people jumping from VB to Javascript and back!
     
    Sleeping Troll, Jun 26, 2008 IP
  12. yugolancer

    yugolancer Well-Known Member

    Messages:
    321
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #12
    Why not just this simple:

     
    yugolancer, Jun 29, 2008 IP
  13. Alby

    Alby Active Member

    Messages:
    151
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #13
    Over my head !!
     
    Alby, Jul 15, 2008 IP
  14. ximplix

    ximplix Active Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #14
    have you tried to update the framework version, may be it can help
     
    ximplix, Jul 20, 2008 IP
  15. esauldaris

    esauldaris Peon

    Messages:
    946
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #15
    esauldaris, Aug 3, 2008 IP
  16. whirlybird20

    whirlybird20 Guest

    Messages:
    462
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Thanks for the information!
     
    whirlybird20, Aug 9, 2008 IP
  17. red-sky

    red-sky Peon

    Messages:
    89
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Currently struggling with ASP myself (but getting there :rolleyes:), thanks for the tips mate.
     
    red-sky, Aug 11, 2008 IP
  18. BtSEO

    BtSEO Peon

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    very helpful. I need to try this
     
    BtSEO, Sep 1, 2008 IP
  19. sanjay_bhuarya

    sanjay_bhuarya Peon

    Messages:
    379
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #19
    for wht it is used for :-??
     
    sanjay_bhuarya, Sep 19, 2008 IP
  20. killer2022

    killer2022 Peon

    Messages:
    158
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Wow, I was looking for this thanks!
     
    killer2022, Oct 14, 2008 IP