Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > Wrox Book Feedback
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Wrox Book Feedback A forum to submit feedback on Wrox books if other forums on P2P have been unable to address your book-specific needs. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Wrox Book Feedback 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 January 7th, 2011, 05:12 AM
Registered User
 
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PlanetWrox - Small bug in code

Hello.

I have recently been through the book Beginning ASP.NET 4 in C# and VB and have found a small bug in the code of the www.PlanetWrox.com web site (i.e. built from the book).

On the Gig Pics page, when you select an item from the drop down list that has more than 3 pictures (i.e. more than one page), go to the next or last page (Next or Last button), then select an album with up to 3 pictures (i.e. one page), the ListView control shows "No data was returned".

For example -
1) go to www.planetwrox.com
2) Select Gig Pics from menu
3) Select Pam's Pics from drop down
4) Click the "Last" button
5) Select Bubba Lines from the dropdown - "No data was returned" is shown
6) Select Brothers In Arms from dropdown - Album cover pic shows
7) Re-select Bubba Lines from dropdown - now we see a pic of Mr Incredible

I presume that there's a nice easy fix for this... some C# code for the dropdown On Select method to initialise the ListView, perhaps.

I would really appreciate it if someone could advise.

Many thanks.

Last edited by RiversideAce; January 7th, 2011 at 05:24 AM.
Reply With Quote
  #2 (permalink)  
Old January 7th, 2011, 07:39 AM
Imar's Avatar
Wrox Author
Points: 66,836, Level: 100
Points: 66,836, Level: 100 Points: 66,836, Level: 100 Points: 66,836, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,161
Thanks: 65
Thanked 1,394 Times in 1,374 Posts
Default

Hi there,

Yes, you're correct. This is indeed a problem.
Quote:
I presume that there's a nice easy fix for this... some C# code for the dropdown On Select method to initialise the ListView, perhaps
And that's indeed the fix. For a detailed explanation, check out this post:

http://leedumond.com/blog/resetting-...in-a-listview/

The following should do the trick:

Code:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
  CommandEventArgs commandEventArgs = new CommandEventArgs("First", "");
  DataPager pager = ListView1.FindControl("DataPager1") as DataPager;
  if (pager != null)
  {
    NextPreviousPagerField nextPreviousPagerField = pager.Fields[0] as NextPreviousPagerField;
    if (nextPreviousPagerField != null)
    {
      nextPreviousPagerField.HandleEvent(commandEventArgs);
    }
  }
}
This also requires the following addition to the DropDownList in markup:

Code:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="EntityDataSource1" DataTextField="Name" DataValueField="Id" onselectedindexchanged="DropDownList1_SelectedIndexChanged" />
For future posts like these, you're better off posting in the book's own forum category: http://p2p.wrox.com/book-beginning-asp-net-4-c-vb-560/

Hope this helps,

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
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
ch06 source code bug rdfield BOOK: Professional XMPP Programming with JavaScript and jQuery 2 December 29th, 2011 04:52 PM
A small problem with the code from CH06 and with next ones. Jeremie BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 February 15th, 2009 06:40 AM
a big bug on a code busteronline ASP.NET 1.0 and 1.1 Basics 0 September 15th, 2008 09:11 AM
Need help with a small piece of code (New to VB) kwik10z Excel VBA 2 October 12th, 2007 06:46 AM
small C++ game code PLEASE HELP!!! ands122 C++ Programming 2 June 18th, 2005 04:55 PM



All times are GMT -4. The time now is 10:11 AM.


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