TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Radim Motycka
NA
31
32k
EntityDataSource vs Routing
Jan 22 2012 4:39 PM
Hello,
Pls would you advise?
I am using routing from hyperlink button. It creates the route for instance "
http://localhost:52565/home/1
" .
And then I am passing it into entitydatasource.
<asp:EntityDataSource ID="WitzenDataSource" runat="server"
ConnectionString="name=WitzenDBEntities"
DefaultContainerName="WitzenDBEntities" EnableFlattening="False"
EntitySetName="Witzens" Where="it.TagID == @TagID and it.Approved == true"
>
<WhereParameters>
<asp:RouteParameter Name="TagID" RouteKey="home" DbType="Int16" />
</WhereParameters>
</asp:EntityDataSource>
and the output to the ListView shows nothing.
If I change it into:
<asp:EntityDataSource ID="WitzenDataSource" runat="server"
ConnectionString="name=WitzenDBEntities"
DefaultContainerName="WitzenDBEntities" EnableFlattening="False"
EntitySetName="Witzens" Where="it.TagID == 1 and it.Approved == true"
>
<%-- <WhereParameters>
<asp:RouteParameter Name="TagID" RouteKey="home" DbType="Int16" />
</WhereParameters>--%>
</asp:EntityDataSource>
It works normally and I get the needed filtered output.
Please advice am I missing something?
I also added DataKeyNames="ID" or DataKeyNames="TagID" into ListView.
Route def is:
RouteTable.Routes.MapPageRoute("HomePageFiltered", "home/{TagID}", "~/Pages/HomePage.aspx");
And hyperlink button is:
<asp:HyperLink runat="server" Text='<%# Eval("Tag") + Eval ("Witzen.Count","({0})") %>' NavigateUrl='<%# GetRouteUrl("HomePageFiltered", new { TagID = Eval("TagID") } ) %>' />
Many Thx
Radim
Reply
Answers (
1
)
could u tell where i can get c#.net code for practice.
WebService