entity framework doesn't work as a datasource?

Discussion in 'ASP .Net' started by Andy B, Nov 8, 2008.

  1. Andy B

    Andy B Guest

    I have the following code and can't quite figure out why it doesn't work. in
    the first section, I am trying to take the data from a entity framework
    function import and use it inside a repeater.

    <asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
    <% #Bind("Title") %>
    </ItemTemplate>
    </asp:Repeater>

    In this section of code, I have the code that creates the entity context and
    (I think) runs the function GetAllNews and binds it to the repeater control.
    This doesn't seem to work for some reason.

    Dim NewsContext As New eternityrecordsonlineEntities()
    Repeater1.DataSource = NewsContext.GetAllNews()

    I get this error from vs2008 when I am in the markup of the page:
    Error 1 'If', 'ElseIf', 'Else', 'End If', 'Const', or 'Region' expected.
    C:\Documents and Settings\Andy\My Documents\Visual Studio
    2008\Projects\Test\Test\Test\Default.aspx Test

    Any idea why this is?
     
    Andy B, Nov 8, 2008
    #1
    1. Advertising

  2. Andy B

    Andy B Guest

    Ok. Fixed my own problem. the # was in the wrong spot.


    "Andy B" <> wrote in message
    news:%238rR%...
    >I have the following code and can't quite figure out why it doesn't work.
    >in the first section, I am trying to take the data from a entity framework
    >function import and use it inside a repeater.
    >
    > <asp:Repeater ID="Repeater1" runat="server">
    > <ItemTemplate>
    > <% #Bind("Title") %>
    > </ItemTemplate>
    > </asp:Repeater>
    >
    > In this section of code, I have the code that creates the entity context
    > and (I think) runs the function GetAllNews and binds it to the repeater
    > control. This doesn't seem to work for some reason.
    >
    > Dim NewsContext As New eternityrecordsonlineEntities()
    > Repeater1.DataSource = NewsContext.GetAllNews()
    >
    > I get this error from vs2008 when I am in the markup of the page:
    > Error 1 'If', 'ElseIf', 'Else', 'End If', 'Const', or 'Region' expected.
    > C:\Documents and Settings\Andy\My Documents\Visual Studio
    > 2008\Projects\Test\Test\Test\Default.aspx Test
    >
    > Any idea why this is?
    >
    >
    >
     
    Andy B, Nov 8, 2008
    #2
    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. Samuel van Laere

    Entity Name or Entity Number?

    Samuel van Laere, Feb 24, 2007, in forum: HTML
    Replies:
    4
    Views:
    1,652
    Jukka K. Korpela
    Feb 24, 2007
  2. markla
    Replies:
    1
    Views:
    555
    Steven Cheng
    Oct 6, 2008
  3. Seema

    entity datasource at run time

    Seema, Jun 2, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    358
    Seema
    Jun 2, 2009
  4. Norm
    Replies:
    3
    Views:
    2,742
  5. ThatsIT.net.au

    Entity, problem with entity key

    ThatsIT.net.au, Sep 6, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    1,206
    ThatsIT.net.au
    Sep 7, 2009
Loading...

Share This Page