We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

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

d_melnyk
d_melnyk asked
on
Medium Priority
452 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
Comment
Watch Question

Carlos VillegasFull Stack .NET Developer

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

Carlos VillegasFull Stack .NET Developer

Commented:
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.

Author

Commented:
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
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Carlos VillegasFull Stack .NET Developer

Commented:
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.
Carlos VillegasFull Stack .NET Developer

Commented:
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 <
Carlos VillegasFull Stack .NET Developer

Commented:
Sorry I mistyped that, I refer to a PlaceHolder, not ContentPlaceHolder, and by the way im wrng with the label control, it render well
Carlos VillegasFull Stack .NET Developer

Commented:
But other controls can do that implicit conversion

Author

Commented:
resolved issue and works for what I need
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.