Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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
 
Old October 22nd, 2015, 10:03 AM
Registered User
 
Join Date: Oct 2015
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 - Page 226 to 228

When attempting the 'Try it out' I'm getting the following error message: 'ASP.masterpages_frontend_master' does not contain a definition for 'ThemeList_SelectedIndexChanged' and no extension method 'ThemeList_SelectedIndexChanged' accepting a first argument of type 'ASP.masterpages_frontend_master' could be found (are you missing a using directive or an assembly reference?)
What have I missed? I've compared my version of FrontEnd.Master & the code behind to the version supplied and could not find the error.
--------------------
Compiler Error Message: CS1061: 'ASP.masterpages_frontend_master' does not contain a definition for 'ThemeList_SelectedIndexChanged' and no extension method 'ThemeList_SelectedIndexChanged' accepting a first argument of type 'ASP.masterpages_frontend_master' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 24: <asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ThemeList_SelectedIndexCha nged">

Last edited by martinedhotman; October 22nd, 2015 at 10:50 AM..
 
Old October 22nd, 2015, 06:58 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Can you post your code?

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!
 
Old October 23rd, 2015, 03:12 AM
Registered User
 
Join Date: Oct 2015
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm using VS 2015. Theme 'Monochrome' would not load, so I renamed it 'BlueGrey'
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="FrontEnd.master.cs" Inherits="MasterPages_FrontEnd" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div id="PageWrapper">
            <header><a href="/"></a></header>
            <nav>Menu Goes Here</nav>
            <section id="MainContent">
                <asp:ContentPlaceHolder ID="cpMainContent" runat="server">
                    This is default text that shows up in content pages that don't explicitly override it.
                </asp:ContentPlaceHolder>
            </section>
            <aside id="Sidebar">
                Select a theme
        <br />
                <asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ThemeList_SelectedIndexChanged">
                    <asp:ListItem>BlueGrey</asp:ListItem>
                    <asp:ListItem>DarkGrey</asp:ListItem>
                </asp:DropDownList>
            </aside>
            <footer>Footer Goes Here</footer>
        </div>
    </form>
</body>
</html>
 
Old October 23rd, 2015, 04:55 AM
Registered User
 
Join Date: Oct 2015
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've changed the dropdown list ID from ThemeList to ThemeSel and this resolved the problem.

I'm loving the book by the way.
 
Old October 24th, 2015, 03:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The ID of the control shouldn't matter; it's the name of the method that is assigned in OnSelectedIndexChanged that is relevant. It needs to have a matching method in the code behind.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 8 Ajax.ActionLink, at page 197. PartialView displayed as its own page. JimiFriis BOOK: Professional ASP.NET MVC 4 1 March 25th, 2015 04:18 AM
Errata Chapter 6 page 226 [email protected] BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 1 January 25th, 2015 12:21 PM
Chapter 6 pps 226-228 User Selected Theme Featheriver BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 20th, 2011 07:08 AM
Please clarify this in Chapter 6 (pages 226-232) pennkaiser BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 August 4th, 2010 01:59 PM
Error in GetEaster method on page 226 peryan77 BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 1 November 20th, 2009 12:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.