 |
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 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
|
|
|
|
|

October 1st, 2011, 12:38 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
|
|
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.
|
|

October 1st, 2011, 04:47 AM
|
|
Authorized User
|
|
Join Date: Dec 2009
Posts: 69
Thanks: 6
Thanked 0 Times in 0 Posts
|
|
Banner
Quote:
Originally Posted by morteza
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
|
|

October 1st, 2011, 05:02 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 1st, 2011, 09:00 AM
|
|
Authorized User
|
|
Join Date: Dec 2009
Posts: 69
Thanks: 6
Thanked 0 Times in 0 Posts
|
|
[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
|
|

October 1st, 2011, 11:11 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 2nd, 2011, 03:21 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 2nd, 2011, 12:01 PM
|
|
Friend of Wrox
|
|
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
|
|
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.
|
|

October 5th, 2011, 06:09 PM
|
|
Authorized User
|
|
Join Date: Dec 2009
Posts: 69
Thanks: 6
Thanked 0 Times in 0 Posts
|
|
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
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
|
|
|

October 6th, 2011, 12:44 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2010
Posts: 125
Thanks: 20
Thanked 3 Times in 3 Posts
|
|
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.
|
|

October 6th, 2011, 01:35 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |
|