我的解决方案由单个页面“Content.aspx”组成,我用它根据查询字符串填充不同类型的html数据。
如果可能的话,我需要知道如何在我的页面中加载aspx内容。 我尝试添加代码如下:
<asp:Label ID="lblName" runat="server"></asp:Label>
但它显示为纯文本。 这是我用来从数据库中检索数据的代码。
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*/
}
}
任何帮助将不胜感激。感谢
答案 0 :(得分:0)
使用StringBuilder
和Literal
StringBuilder sb = new StringBuilder();
sb.append("Your Contain From Database");
Literal1.Text = sb.ToString(); //Bind Contain to Litral
StringBuilder AppendFormat方法对于基于模式生成文本非常有用。