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 April 15th, 2017, 12:03 PM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Ch 13: page 445 - Themes = ''

For Chapter 13 - Displaying and Updating Data, page 445, I added a new web.config file to my Managements folder with:

Code:
<pages theme = ""
However, I am still getting the image in the <nav> element from the Monochrome.css file that's in my Themes folder.

What am I doing wrong?

Last edited by papadan; April 15th, 2017 at 12:14 PM..
 
Old April 16th, 2017, 05:05 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Is the theme still applied through your custom code based on the user's selection?

Check out the HTML source for the page in the browser and look for links to your theme. That would confirm a specific theme is still in use.

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 April 16th, 2017, 03:11 PM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Themes

<<Is the theme still applied through your custom code based on the user's selection? >>

I don't have it set up as custom code (maybe?) - I am linked to the theme as Theme="MainTheme" In other words, I am only using Monochrome theme. I know I don't have to (based on a previous post we discussed) - but I have it in place currently. The other theme isn't loaded nor does the user have any options to switch.

Maybe that's the problem? Maybe the book instructed me to set things up in a "Custom Code" theme fashion. And I didn't.

In any case, to answer your second question:

<<Check out the HTML source for the page in the browser and look for links to your theme. That would confirm a specific theme is still in use.>>

Yes, the specific theme is still in use:

Code:
<head>
   <link href="../App_Themes/MainTheme/Monochrome.css" 
         type="text/css" rel="stylesheet" />
   <title>Good News Productions - Genres</title>
</head>
I will add that my web.config for the other master page is outside (at the root) - whereas my web.config for the new master page is in the Management folder.
Should my web.config for my monochrome theme be inside its own folder too?

Last edited by papadan; April 16th, 2017 at 03:16 PM..
 
Old April 17th, 2017, 05:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Oh, I see, this is about the management folder. I missed that on your first post.

The following in web.config in your Management folder should clear out the theme:
<?xml version="1.0"?> <configuration> <system.web> <pages theme="" /> </system.web> </configuration>Is it not doing that?

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 April 17th, 2017, 08:55 AM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Mgt folder web.config

<<The following in web.config in your Management folder should clear out the theme:
Code:
?xml version="1.0"?> <configuration> <system.web> <pages theme="" /> </system.web> </configuration>
Is it not doing that?>>

No, it is not working. I have a web.config with that code in my Management folder, but it is not clearing out (or disabling) the theme from my other web.config
 
Old April 18th, 2017, 08:20 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you post an image of your solution explorer online somewhere (you can't add an image as part of a post here so you'll need to upload it somewhere). Make sure it shows the root of the with the App_Code and Management folders expanded. I just tried it locally on a copy of Planet Wrox and it works for me, so it must be something in your setup.

Also: are the pages in the Management folder using their own master page? Can you post the code for the following:

1. Code behind of a page in the Management folder
1. Markup of a page in the Management folder
1. Code of BasePage.vb/cs from App_Code

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 April 18th, 2017, 11:46 AM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Themes

Quote:
Can you post an image of your solution explorer online somewhere (you can't add an image as part of a post here so you'll need to upload it somewhere). Make sure it shows the root of the with the App_Code and Management folders expanded.
The only place i could think of to download my image was on Face Book:

//www.facebook.com/photo.php?fbid=10208833755513844&set=a.44419338191 19.1073741827.1612550798&type=3&theater

Please let me know if you were able to see the image.

Quote:
Code behind of a page in the Management folder
Code:
Partial Class Management_Genres
             Inherits System.Web.UI.Page

          End Class
Quote:
Markup of a page in the Management folder
Code:
<%@ Page Title="Good News Productions - Genres" Language="VB" MasterPageFile="~/MasterPages/Management.master" AutoEventWireup="false" CodeFile="Genres.aspx.vb" Inherits="Management_Genres" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." AllowPaging="True" AllowSorting="True">
  <Columns>
    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" ButtonType="Button"/>
    <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
    <asp:BoundField DataField="SortOrder" HeaderText="SortOrder" SortExpression="SortOrder" />
  </Columns>
</asp:GridView>
  <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="Id" DataSourceID="SqlDataSource1" DefaultMode="Insert" Height="50px" Width="125px">
    <Fields>
      <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" ReadOnly="True" SortExpression="Id" />
      <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
      <asp:BoundField DataField="SortOrder" HeaderText="SortOrder" SortExpression="SortOrder" />
      <asp:CommandField ShowInsertButton="True" />
    </Fields>
  </asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PlanetWroxConnectionString1 %>" DeleteCommand="DELETE FROM [Genre] WHERE [Id] = @Id" InsertCommand="INSERT INTO [Genre] ([Name], [SortOrder]) VALUES (@Name, @SortOrder)" ProviderName="<%$ ConnectionStrings:PlanetWroxConnectionString1.ProviderName %>" SelectCommand="SELECT [Id], [Name], [SortOrder] FROM [Genre]" UpdateCommand="UPDATE [Genre] SET [Name] = @Name, [SortOrder] = @SortOrder WHERE [Id] = @Id">
  <DeleteParameters>
    <asp:Parameter Name="Id" Type="Int32" />
  </DeleteParameters>
  <InsertParameters>
    <asp:Parameter Name="Name" Type="String" />
    <asp:Parameter Name="SortOrder" Type="Int32" />
  </InsertParameters>
  <UpdateParameters>
    <asp:Parameter Name="Name" Type="String" />
    <asp:Parameter Name="SortOrder" Type="Int32" />
    <asp:Parameter Name="Id" Type="Int32" />
  </UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
Quote:
Code of BasePage.vb/cs from App_Code
Code:
Public Class BasePage
  Inherits System.Web.UI.Page
  Private Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
    If String.IsNullOrEmpty(Me.Title) OrElse Me.Title.Equals("Untitled Page", StringComparison.CurrentCultureIgnoreCase) Then
      Throw New Exception("Page Title cannot be 'Untitled Page' or an empty string.")
    End If
  End Sub
End Class
 
Old April 18th, 2017, 05: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

That all looks good to me. Two more requests:

1. Can you post the code for web.config in the Management folder?

2. Can you post the code for Management.master

If those look fine too, I am not sure what's going on. If you're able to upload a zipped copy of the site, I'll download it and take a look.

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 April 18th, 2017, 07:58 PM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Management Folder

You'd think I would know this - but how do I attach my zip file here?

<<Can you post the code for web.config in the Management folder?>>

Code:
<?xml version="1.0"?>
<configuration>
    <system.web>
      <pages theme="" />
    </system.web>
</configuration>
<<Can you post the code for Management.master>>

Code:
<%@ Master Language="VB" CodeFile="Management.master.vb" Inherits="MasterPages_Management" %>

<!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>
      <nav class="noimg" style="width: 200px; float: left;">
        <ul>
          <li><a href="~/Management/Default.aspx" runat="server">
                      Management Home</a></li>
          <li><a href="~/Management/Genres.aspx" runat="server">Manage Genres</a></li>
          <li><a href="~/Management/Reviews.aspx" runat="server">Manage Reviews</a></li>
        </ul>
      </nav>
      <section style="width: 750px; float: left;">
        <asp:ContentPlaceHolder id="cpMainContent" runat="server">
        
        </asp:ContentPlaceHolder>
      </section>
    </div>
    </form>
</body>
</html>

Last edited by papadan; April 18th, 2017 at 08:02 PM.. Reason: Adding Attachment.
 
Old April 18th, 2017, 08:03 PM
Authorized User
 
Join Date: Mar 2017
Posts: 55
Thanks: 12
Thanked 0 Times in 0 Posts
Default Adding Attachment...

I don't see an option anywhere to "Manage Attachments" ??





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 6 - Themes vs. No Themes papadan BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 4 April 3rd, 2017 09:31 AM
Ch. 6 browser showing combination of the two themes C# only, VB is fine tmulher BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 2 May 15th, 2015 08:51 AM
Ch 6 Stuck on the DDL for Themes Aristide BOOK: Beginning ASP.NET 4.5 : in C# and VB 6 April 1st, 2014 10:37 PM
Ch 4 and Ch 13/15 - controls and the DataPager AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 3 February 24th, 2014 04:56 PM
Search ch 13, ch 16 sporik BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 0 October 27th, 2009 04:44 PM





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