Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
|
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 November 24th, 2015, 11:16 AM
Registered User
 
Join Date: Nov 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 - Named Skins - Warning after unknown change

Hey Imar,

Great book! It should be used in the university course I took on Web Database Development. It looks like it involves all the topics that were taught though I haven't gone all the way through the book yet. Your book is certainly more in-depth and brings in many more ancillary VS topics that make a complete web UI implementation.

In working through chapter 6 Named Skins section, now upon adding the button again in SkinsDemo.aspx, VS adds a third button as shown below and shows the warning: "Unrecognized tag prefix or device filter 'asp'."

<%@ Page Title="Skins Demo" Language="C#" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="SkinsDemo.aspx.cs" Inherits="Demos_SkinsDemo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:Button ID="Button1" runat="server" Text="Button" /> //first button from the TRY IT OUT
<asp:Button ID="Button2" runat="server" text="Button" SkinID="RedButton"/> //second button from the TRY IT OUT
<asp:button runat="server" text="Button" /> //third button as another attempt
</asp:Content>

When I added the second button as directed in the book it was added just like the third button with the same warning so I corrected the attributes. The button still shows as expected in the browser. Somewhere I mis-typed something or am overriding a setting.

At this point I have three warnings that are exactly the same in the IDE for lines 6, 7, and 8 column 6.

Googling did provide many hits but not my exact issue and I am unable to relate any of the hits to my example.

I also note that MyBasePage is no longer in the Add list after right-clicking an appropriate folder. It was there once when I created the SkinsDemo.aspx listed above but is no longer there. MyBasePage is still listed in the Add | Add New Item... list. Does this have something to do with why I am getting the warnings above?

Regards,
Tim

Last edited by mctimoth; November 24th, 2015 at 12:34 PM..
 
Old November 24th, 2015, 08:50 PM
Registered User
 
Join Date: Nov 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I ran through all of the TRY IT OUT examples again starting from my Chapter 5 backup. If I add a button to my default.aspx it gets added thusly:

<asp:button runat="server" text="Button" />

With a small "b" in button and without and ID attribute.

The warnings in the Output window do not appear but if I hover over asp: I get the message: "Unrecognized tag prefix or device filter 'asp'."

Also, I can now right-click on site and go to Add | MyBasePage. That is not there in my incomplete version of the Chapter 6 TRY IT OUT examples.

One more thing, I have two MyBasePage items listed in the Add New Item list.

Why do I always get these esoteric problems?

Last edited by mctimoth; November 24th, 2015 at 08:54 PM..
 
Old November 27th, 2015, 03:46 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 the code for your web.config, your master page and the page you add this button to (markup and code behind)? There might be an error somewhere.

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!
 
Old November 29th, 2015, 09:08 PM
Registered User
 
Join Date: Nov 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Imar,

Here are the files:

<web.config>
<?xml version="1.0"?>

<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->

<configuration>

<system.web>
<pages theme="Monochrome" />
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>

</configuration>
</web.config>
<Frontend.master>
<%@ 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>
<script src="/Scripts/modernizr-2.8.3.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div id ="PageWrapper">
<header><a href = "/"><%--Header Goes Here--%></a></header>
<nav>Menu Goes Here</nav>
<section id="MainContent">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server">
</asp:ContentPlaceHolder>
</section>
<aside id="Sidebar">
Select a Theme
<br />
<asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ThemeList_SelectedIndexCha nged">
<asp:ListItem>Monochrome</asp:ListItem>
<asp:ListItem>DarkGrey</asp:ListItem>
</asp:DropDownList>
</aside>
<footer>Footer Goes Here</footer>
</div>
</form>
</body>
</html>
</Frontend.master>
<Frontend.master.cs>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPages_Frontend : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string selectedTheme = Page.Theme;
HttpCookie preferredTheme = Request.Cookies.Get("preferredTheme");
if (preferredTheme != null)
{
selectedTheme = preferredTheme.Value;
}
if (!string.IsNullOrEmpty(selectedTheme))
{
ListItem item = ThemeList.Items.FindByValue(selectedTheme);
if (item != null)
{
item.Selected = true;
}
}
}
}
protected void ThemeList_SelectedIndexChanged(object sender, EventArgs e)
{
HttpCookie preferredTheme = new HttpCookie("PreferredTheme");
preferredTheme.Expires = DateTime.Now.AddMonths(3);
preferredTheme.Value = ThemeList.SelectedValue;
Response.Cookies.Add(preferredTheme);
Response.Redirect(Request.Url.ToString());
}
}

</Frontend.master.cs>
<Default.aspx>
<%@ Page Title="Default" Language="C#" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<h1>Hi there visitor and welcome.</h1>
<p class="Introduction">
We're glad you're paying a visit to <a href="http://www.PlanetWrox.com">www.PlanetWrox.com</a>, the coolest music community site on the Internet.</p>
<p class="Introduction">
Feel free to have a <a href="Default.aspx">look around</a>; there are lots of interesting <strong>reviews and concert pictures</strong> to be found here.</p>
<asp:button runat="server" text="Button" />
<p>
You can <a href="Login.aspx">log in</a> here</p>
</section>
</asp:Content>
</Default.aspx>
<Default.aspx.cs>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
</Default.aspx.cs>

Thanks,
Tim
 
Old December 4th, 2015, 11:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I ran your code in a new web site and it all runs fine.

If you still have issues can you zip your site and make it available for download somewhere?

Thanks,

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
Skins, button and themes in Chapter 6 JohnInPomeroy BOOK: Beginning ASP.NET 4.5 : in C# and VB 2 March 16th, 2014 12:10 PM
Chapter 6 - skins demo Zadda BOOK: Beginning ASP.NET 4 : in C# and VB 7 May 1st, 2012 11:35 AM
Warning: Invalid Argument (22) in Unknown Alex1 Beginning PHP 1 August 3rd, 2011 05:20 PM
Chapter 6; Skins CssClass jtruffa BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 11 May 4th, 2009 03:30 PM
ch6 Skins and Named Skins wingri BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 8th, 2008 02:57 AM





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