My solution consists out of a single page, "Content.aspx" which I use to populate with different types of html data depending on the querystring.
I need to know, if possible, how to load aspx content in my page. I've tried adding code like :
<asp:Label ID="lblName" runat="server"></asp:Label>
But it gets displayed as plain text. Here is my code that I use to retrieve the data from the database.
string category = Request.QueryString["category"].ToString();
using (MyEntity dbc = new MyEntity())
{
ContentTables cms = (from c in dbc.ContentTable
where c.Name == category && c.Status == true
select c).First();
divHeader.InnerHtml = cms.Header;
divContent.InnerHtml = cms.Content;
if (cms.Header == "dataPage")
{
/*Code Requirement Here*/
}
}
Any help will be greatly appreciated. Thanks
Use
StringBuilder
andLiteral
The StringBuilder AppendFormat method is useful for generating text based on a pattern.