Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 3rd, 2011, 02:51 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old December 4th, 2011, 05:08 AM
Imar's Avatar
Wrox Author
Points: 65,660, Level: 100
Points: 65,660, Level: 100 Points: 65,660, Level: 100 Points: 65,660, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 15,962
Thanks: 64
Thanked 1,349 Times in 1,329 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old December 4th, 2011, 01:54 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>
Reply With Quote
  #4 (permalink)  
Old December 4th, 2011, 02:27 PM
Imar's Avatar
Wrox Author
Points: 65,660, Level: 100
Points: 65,660, Level: 100 Points: 65,660, Level: 100 Points: 65,660, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 15,962
Thanks: 64
Thanked 1,349 Times in 1,329 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old December 4th, 2011, 03:45 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #6 (permalink)  
Old December 4th, 2011, 05:16 PM
Imar's Avatar
Wrox Author
Points: 65,660, Level: 100
Points: 65,660, Level: 100 Points: 65,660, Level: 100 Points: 65,660, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 15,962
Thanks: 64
Thanked 1,349 Times in 1,329 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old December 5th, 2011, 12:27 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update multiple tables with EntityDataSource alharlow ASP.NET 4 General Discussion 3 March 31st, 2011 03:15 AM
Error with EntityDataSource TeaDrinkingGeek BOOK: Beginning ASP.NET 4 : in C# and VB 3 March 20th, 2011 01:54 PM
Questions about EntityDataSource and dynamic binding Rushino ASP.NET 4 General Discussion 4 November 22nd, 2010 08:58 AM
Chapter 2, Page 76, Exercise 3 Chastini BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 1 March 25th, 2010 09:24 PM
Page 319: Exercise 1 kiwibrit BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 July 3rd, 2009 10:46 AM



All times are GMT -4. The time now is 08:33 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.