?
Solved

link from .html file in update panel to .aspx page fails

Posted on 2011-04-20
9
Medium Priority
?
428 Views
Last Modified: 2012-05-11
hi Folks:

I have a master page which contains an asp:ContentPlaceHolder tag. I am using ajax and javascript to load content into the place holder - specifically information from a standard html file. Within this conent I have a link to call a contact page which is "contact.aspx"

When "contact.aspx" is called from a link on the menu on the master page, everything works fine. When it is called from an <a href> tag in the html file which has been loaded to to the content pace holder, it fails. VS8 says that there is a server error that the "Resource cannot be found..check the url. However, the url is correct - indicates same url as indicated when click n the link from the menu in the master page.

Any assistance would be greatly appreciated... as the code is somewhat extensive I will hold off posting for the moment hoping that I am missing something simple! Otherwise I will try and post the relevant pieces.

Best regards, Dave Melnyk
0
Comment
Question by:d_melnyk
  • 6
  • 3
9 Comments
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35437828
Hello, instead of a contant placeholder, try with a literal control, like this:
<asp:Literal Text="Your Html File text" runat="server"  />

Open in new window

0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35437861
Example:

In your code behind:

C#:
MyLiteralControl.Text = System.IO.File.ReadAllText(@"C:\MyHtmlFile.html");

Open in new window



VB.NET:
MyLiteralControl.Text = System.IO.File.ReadAllText("C:\MyHtmlFile.html")

Open in new window


In you aspx file:
<asp:Literal ID="MyLiteralControl" runat="server" />

Open in new window

Placed where you want to render it.
0
 

Author Comment

by:d_melnyk
ID: 35438182
Thanks for the reply... haven't used that method ... at this point it would be a major re-write of the entire website, yet again, ....will try and post the code I am using tomorrow.....

regards, Dave Melnyk
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
d_melnyk earned 0 total points
ID: 35442832
Hi folks:

     Posted the code, but seemed to have done something to mess it up and post didn't come in. HOWEVER, did solve the problem.

Simply used  a call to javascript on the masterpage to load the url of the aspx page
        <a href="#"; onclick="callaspxpage('njhacontact.aspx')";>my link</a>

This sems to work perfectly.
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35442888
Hello buddy, I want to let you know the difference between the ContentPlaceHolder vs LiteralControl, the literal always is going to write to the webbrowser exactly the content of your html file, if you use, for example, a Label, inside your contentplaceholder it is going to parse your text file, so keep that in mind.
You can also use a Literal Control inside a ContentPlaceHolder too, it will work fine.
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35442908
Example, if you set a label with the Text = "<" ASP.NET is going to send to the client web browser the string &lt; that is the html representation of the character <
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35442977
Sorry I mistyped that, I refer to a PlaceHolder, not ContentPlaceHolder, and by the way im wrng with the label control, it render well
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 35442993
But other controls can do that implicit conversion
0
 

Author Closing Comment

by:d_melnyk
ID: 35735941
resolved issue and works for what I need
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question