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
  #11 (permalink)  
Old October 1st, 2011, 01:38 AM
Friend of Wrox
Points: 547, Level: 8
Points: 547, Level: 8 Points: 547, Level: 8 Points: 547, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Quote:
Morteza,
I am no longer able to run the browser because of the error.
You can run browser even it has errors. Please tell me error page URL. Test following(i assume you have only "ELement 'Banner' is not known element" error)tips. If one of approaches worked keep stop process an please comment.

1- Remove
Quote:
<controls>
<add tagPrefix="Wrox" tagName="Banner" src="~/controls/Banner.ascx" />
</controls>
and Banner1 control in masterpage and instead of that in design view drag Banner user control into master page and drop it.
2- Completely Remove( hold it outside the project) Banner user control and copy Banner control from book source code to your project.
3- Run your application in iis( do you know how?)
4- If any of above issues don't works please run your website in other PC. I think your VS 2010 has problem.
__________________
Please excuse me for poor and bad English.
Reply With Quote
  #12 (permalink)  
Old October 1st, 2011, 05:47 AM
Authorized User
Points: 378, Level: 6
Points: 378, Level: 6 Points: 378, Level: 6 Points: 378, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2009
Posts: 67
Thanks: 6
Thanked 0 Times in 0 Posts
Default Banner

Quote:
Originally Posted by morteza View Post
You can run browser even it has errors. Please tell me error page URL. Test following(i assume you have only "ELement 'Banner' is not known element" error)tips. If one of approaches worked keep stop process an please comment.

1- Remove and Banner1 control in masterpage and instead of that in design view drag Banner user control into master page and drop it.
2- Completely Remove( hold it outside the project) Banner user control and copy Banner control from book source code to your project.
3- Run your application in iis( do you know how?)
4- If any of above issues don't works please run your website in other PC. I think your VS 2010 has problem.
Morteza,

I think I found the problem.

I did what you said and also removed one line from AboutUs (code Behind), which is [Banner2.DisplayDirection=Direction.Vertical/] and everything is working fine. As soon as I put the line back I had the following error:
"Banner2 is not declared. It may be inaccessible due to its protection level".

So this is the problem and don't know how to fix it. I also don't know how to run my application in IIS. I would appreciate your help.

Thank you very much
Regards
Khalil
Reply With Quote
  #13 (permalink)  
Old October 1st, 2011, 06:02 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Running your site from IIS shouldn't be necessary.

As hinted earlier, maybe there's a problem with the control itself? Can you post its code? Or better yet, try adding my control from the book's download to the project, and then drop it on the design surface of a page. Does it work then?

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
  #14 (permalink)  
Old October 1st, 2011, 10:00 AM
Authorized User
Points: 378, Level: 6
Points: 378, Level: 6 Points: 378, Level: 6 Points: 378, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2009
Posts: 67
Thanks: 6
Thanked 0 Times in 0 Posts
Default

[quote=Imar;276993]Running your site from IIS shouldn't be necessary.

As hinted earlier, maybe there's a problem with the control itself? Can you post its code? Or better yet, try adding my control from the book's download to the project, and then drop it on the design surface of a page. Does it work then?

I removed one line from AboutUs (code Behind), which is [Banner2.DisplayDirection=Direction.Vertical/] and everything is working fine. As soon as I put the line back I had the following error:
"Banner2 is not declared. It may be inaccessible due to its protection level".


So this is the problem and don't know how to fix it.
The codeof my control is:
[<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Banner.ascx.vb" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
<a href="http://p2p.wrox.com" target="_blank">
<asp:Image ID="Image1" runat="server" AlternateText="This is a sample banner"
ImageUrl="~/Controls/Images/Banner120x240.gif" />
</a>
</asp:Panel>

<asp:Panel ID="HorizontalPanel" runat="server">
<a href="http://p2p.wrox.com" target="_blank">
<asp:Image ID="Image2" runat="server" AlternateText="This is a sample banner"
ImageUrl="~/Controls/Images/Banner468x60.gif" />
</a>
</asp:Panel>/]

Cheers
Khalil
Reply With Quote
  #15 (permalink)  
Old October 1st, 2011, 12:11 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

OK, try this:

1. Confirm you have a Web Site Project (each ASPX file should only have one Code Behind file)

2. Make sure you created the Direction Enum in the App_Code folder in a .cs or .vb code file

3. Make sure you added the property DisplayDirection to the Baner control's code behind.

4. Drag the control to a page again.

If you have trouble figuring this all out, zip up the site and send me a copy. You'll find my e-mail address in the introduction section 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
  #16 (permalink)  
Old October 2nd, 2011, 04:21 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Thanks for the source. The code looks fine to me for the most part (after I figured out which of the many folders you sent me contained your site).

A few remarks:

1. The App_Code folder contains your About and Reviews folder which is not OK as you can't request them and they may cause other issues. This files and folders should really be in the site's root.

2. How do you open the web site and what do you see in the browser? Here's what you should do and what works for me:

a) Start VWD and choose File | Open Web Site. Browse to the folder C:\BegASPNET\PlanetWrox and click OK. Make sure you don't choose the parent folder C:\BegASPNET

b) Open the Project's Properties Grid (select the project in the Solution Explorer and hit F4) and set the Virtual Path property to /

c) Hit F5. The homepage should appear appear with the banner in Horizontal mode

d) Open the Master file and add DisplayDirection="Vertical".

e) Save and reload

If this still doesn't work, between step b and c, move the About and Reviews folders to the root of the site, and right-click the project and choose Build or Rebuild.

If it still doesn't work, I don't know what's going on. It works fine for me with the code you sent me.

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
  #17 (permalink)  
Old October 2nd, 2011, 01:01 PM
Friend of Wrox
Points: 547, Level: 8
Points: 547, Level: 8 Points: 547, Level: 8 Points: 547, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Hi Khalil,
I think the problem is by your vs 2010 . Try testing project in another PC(with vs 2010) as i suggested in earlier .
__________________
Please excuse me for poor and bad English.
Reply With Quote
  #18 (permalink)  
Old October 5th, 2011, 07:09 PM
Authorized User
Points: 378, Level: 6
Points: 378, Level: 6 Points: 378, Level: 6 Points: 378, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2009
Posts: 67
Thanks: 6
Thanked 0 Times in 0 Posts
Default Banner2

Hi Imar,

I still have a problem with "Banner2".
The following is my code in AboutUs and its code behind:

[<Wrox:Banner ID="Banner2" runat="server" DisplayDirection="Horizontal" ></Wrox:Banner>/>]

[Partial Class About_AboutUs
Inherits BasePage

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Banner2.NavigateUrl = "http://imar.spaanjaars.com"
End If
End Sub

End Class]


Regards
Khalil


Quote:
Originally Posted by Khalil View Post
Dear Imar,

I have restarted Visual Studio several times and even compared my codes with the downloaded ones and cannot find anything wrong. My web.config codes are:
[<?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">
<controls>
<add tagPrefix="Wrox" tagName="Banner" src="~/controls/Banner.ascx" />
</controls>
</pages>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
</configuration>/]

Thank you for attending to my query.

Regards
Khalil
Reply With Quote
  #19 (permalink)  
Old October 6th, 2011, 01:44 AM
Friend of Wrox
Points: 547, Level: 8
Points: 547, Level: 8 Points: 547, Level: 8 Points: 547, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
Default

Hi Khalil,
I am sorry, But Please pay attention to our ask for using book source code. By this we can find the problem is by VS 2010 or by Banner User control.
Morteza
__________________
Please excuse me for poor and bad English.
Reply With Quote
  #20 (permalink)  
Old October 6th, 2011, 02:35 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Is that all the code in AboutUs.aspx? If not, can you please post the full code? This may be easy to solve but not without knowing what's going on....

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
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
MCMS 2002 site wide search problem jey_cms General .NET 0 March 13th, 2007 09:32 AM
MCMS 2002 site wide search problem jey_cms General .NET 0 March 13th, 2007 09:23 AM
send e-mail to user after registration p2ptolu Classic ASP Databases 6 April 8th, 2005 06:32 AM
Any Idea About Site Wide Search Engine yoord BOOK: Beginning ASP.NET 1.0 8 October 11th, 2004 09:31 AM
Site Wide Enum - Best Practice rodmcleay ASP.NET 1.0 and 1.1 Professional 8 June 8th, 2004 09:03 AM



All times are GMT -4. The time now is 02:35 PM.


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