Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > entity framework doesn't work as a datasource?

Reply
Thread Tools

entity framework doesn't work as a datasource?

 
 
Andy B
Guest
Posts: n/a
 
      11-08-2008
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?



 
Reply With Quote
 
 
 
 
Andy B
Guest
Posts: n/a
 
      11-08-2008
Ok. Fixed my own problem. the # was in the wrong spot.


"Andy B" <(E-Mail Removed)> wrote in message
news:%238rR%(E-Mail Removed)...
>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?
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Entity, problem with entity key ThatsIT.net.au ASP .Net 1 09-07-2009 02:20 AM
Entity Framework - Reassigning child entity's parent Norm ASP .Net 3 07-06-2009 07:28 PM
How to relate a SQL based entity with an Object based entity in Entity Framework markla ASP .Net 1 10-06-2008 09:42 AM
Entity Name or Entity Number? Samuel van Laere HTML 4 02-24-2007 10:11 PM
COMInterop does not work in Framework 1.1 without Framework 1.0 Anatoly Volodko ASP .Net 1 08-14-2003 08:11 PM



Advertisments