473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem with pulling page content (mix html and Inline ASP) from SQL database.

I'm in the process of self teaching myself ASP.net and keep encountering the problem of knowing what I want to do, but being unable to ask the correct questions.

In short I am working on a website that will end up being comprised of numerous very similar pages.

I was planning to employ a nested Site Masters storing the actual variable data in a SQL Database.

I am able to pull my HTML code from the data base using the following method.

This code in ASPX

Expand|Select|Wrap|Line Numbers
  1. <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
  2.     <asp:Literal ID="Header_Literal" runat="server"></asp:Literal>
  3. </asp:Content>
  4.  
  5. <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
  6.     <asp:Literal ID="Body_Literal" runat="server"></asp:Literal>
  7. </asp:Content>
  8.  
This code in the Codebehind

Expand|Select|Wrap|Line Numbers
  1.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.  
  3.         Dim con As New System.Data.SqlClient.SqlConnection
  4.         con.ConnectionString = "Data Source=XXXXXXXXXXX\SQLEXPRESS;Initial Catalog=master;Integrated Security=True"
  5.         Dim adp As New System.Data.SqlClient.SqlDataAdapter("select * from XXXXXXXXXX", con)
  6.         Dim dt As New System.Data.DataTable
  7.         adp.Fill(dt)
  8.  
  9.         Header_Literal.Text = dt.Rows(0).Item("Meta_Tags")
  10.         Body_Literal.Text = dt.Rows(0).Item("Page_Title")
  11.  
  12.     End Sub
  13.  
The Literal with ID=Header_Literal works perfectly because it is receiving plain HTML from the SQL table.

The Literal ID=Body_Literal gets data, but it is comprised of html and an Inline code element. The HTML works, but the Inline code is being ignored.

I am guessing that this is a problem with me using the Literal control, but I am unclear what I should be using instead.

The content is plain text and the Inline was a calling a codebehind element to mask my email address.

What should I be doing here. Or just as valuable what should I be searching for to learn this on my own?
Jul 19 '10 #1
0 1077

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Massa | last post by:
Hi all, I need some help on this one: I have a webpage with a form. This form submits data that goes to a mdb file (id (AutoNumber), name, email contry etc.). I would like to make another page...
10
by: Andrew | last post by:
I am making a web site and I am using ASP because of its templating capabilities. My footer is an include file, for obvious reasons. I can't use an include file for the header, because, while the...
1
by: Mark | last post by:
Hi - apologies in advance if this is not the correct forum - tried searching loads, and still to find a workable solution. Generating a word document from ASP - no problem. Inserting page breaks...
1
by: jackogreen | last post by:
Hi, My Asp database generated pages' content links all open a new window containing the same page by default; this is strange since the default behavior for anchor links is to open in the same...
2
by: Catherine Lynn Wood | last post by:
I need to know how to overlap DIV content within 'relative' associated rendering. I am building div layers in the middle of a page and when I set positioning to absolute in the CSS, it references...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
1
by: C | last post by:
Hi I have a web app whereby the content for each page is stored in the database This content is interweaved in html and saved in the Database As a result when teh user does a search through...
5
by: wptpro | last post by:
I need to create an aspx page that returns a data string with no html code. In ASP it would be easy by not including any HTML code and then doing a repsonse.write "my data string". How do i do...
2
by: tradmusic.com | last post by:
Hi, I'm new to CSS and, following some advice, created my page like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>...
2
by: pagates | last post by:
Hello All, Newbie question alert! We have a website that we want to eventually convert from pure HTML to ASP.NET pages. Unfortuantely, we cannot do this all at once, but rather, will likely...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.