 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 3rd, 2011, 03:51 PM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
EntityDataSource Try it Out Exercise Page 497
Hi there!
I am a beginner but things have been going quite smoothly until this exercise on page 497 onwards on EntityDataSource control. I was find until step 8 when despite being data source being configured properly (as far as I can see!), the DetailsView control's columns won;t refresh to show Id and Name columns! When I try to refresh, I get an error message saying "Could not find CLR type for PlanetWroxModel.Photoalbum".
I would be grateful to get your help - I just can;t see anything wrong anywhere!
I have really enjoyed this book so far.
Thanks,
Bimal
|

December 4th, 2011, 06:08 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Can you provide more information, such as the relevant code for the pages. Also, make sure you database was setup correctly (primary and foreign keys and so on) before you create the EDMX diagram.
Cheers,
Imar
|

December 4th, 2011, 02:54 PM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
EntityDataSource Try it Out - Chapter 14
THnaks very much for coming back, Imar. Here;s the code for the page o(NewPhotoAlbum.aspx):
Code:
<%@ Page Title="Create New Photo Album" Language="C#" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="NewPhotoAlbum.aspx.cs" Inherits="_NewPhotoAlbum" %>
<%@ Import Namespace="PlanetWroxModel" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:DetailsView ID="DetailsView1" runat="server"
DataSourceID="EntityDataSource1" Height="50px" Width="125px">
<Fields>
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
<asp:EntityDataSource ID="EntityDataSource1" runat="server"
ConnectionString="name=PlanetWroxEntities"
DefaultContainerName="PlanetWroxEntities" EnableFlattening="False"
EntitySetName="Photoalbums" EnableDelete="True" EnableInsert="True"
EnableUpdate="True" EntityTypeFilter="Photoalbum">
</asp:EntityDataSource>
</asp:Content>
|

December 4th, 2011, 03:27 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
And what about the other info? Is the database set up correctly? How did you define the primary and foreign keys? And did you update the database before you created the model? And how exactly did you create this demo page? And is Photoalbum the right name or should it be PhotoAlbum?
Finally, when you use the sample page that comes with this book's download, does it work? (I am trying to find out of the issue is in the code, the model or the database).
Cheers,
Imar
|

December 4th, 2011, 04:45 PM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
EntityDataSource Try it Out - Chapter 14
Hi Imar,
Thanks for your prompt reply. I have checked all these issues and can't see anything wrong. I am sure I am missing something.
Is the database set up correctly? How did you define the primary and foreign keys?
As far as I can see, the primary and foreign keys are properly setup, i.e. Id in Photoalbum table is linked to PhotoalbumId in the Picture table.
And did you update the database before you created the model? And how exactly did you create this demo page?
Yes, I did.
And is Photoalbum the right name or should it be PhotoAlbum?
Probably not. But, this is the name used everywhere.
Finally, when you use the sample page that comes with this book's download, does it work?
Yes.
Many thanks,
Bimal
|

December 4th, 2011, 06:16 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
If I compare my code with yours, I can see a few differences:
1. I don't have an Imports for the PlanetWroxModel namespace
2. You have an EntityTypeFilter set to Photoalbum which you don't need.
There are other differences but they shouldn't matter. What happens when you remove these two statements?
Also, my code has a DataKeyNames and yours doesn't, possible indicating an issue with the primary key in the database.
Quote:
Finally, when you use the sample page that comes with this book's download, does it work?
Yes.
|
Did you just copy in the code for this page (that is, are you using your model and database) or are you testing this on the full sample project?
If this still doesn't work, send me zipped copy of the project with just the necessary files to reproduce the problem and I'll take a look. My e-mail address is in the beginning of the book.
Cheers,
Imar
|

December 5th, 2011, 01:27 PM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
EntityDataSource Try it Out - Chapter 14
Thanks, Imar. I have changed things as suggested by you and now it seems to work.
Thanks very much. You have been really helpful,
Bimal
|
|
 |
|