Unable to render html in aspx page

woodhzht

New Member
Here is my ascx control page code\[code\] <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Menu.ascx.cs" Inherits="CrossQueue.Web.Menu" %><asp:Label ID="lblMenu" runat="server"></asp:Label>\[/code\]Here is my c# code\[code\]private void CreateMenu() { StringBuilder menuHtml = new StringBuilder(); int profileId = 0; MenuBL menuManager = new MenuBL(); DataTable dtMenu = null; if (Session["USR_ID"] != null) { profileId = Convert.ToInt32(Session["USR_PROFILE"]); dtMenu = menuManager.GetAllMenuItemsForProfile(profileId); if (dtMenu != null && dtMenu.Rows.Count > 0) { menuHtml.Append("<table id='tblMenu' cellpadding='0' cellspacing='0' width='939' border='0' align='center'>"); menuHtml.Append("<tr>"); menuHtml.Append("<td align='left'>"); menuHtml.Append(Convert.ToString(Session["USR_USERNAME"])); menuHtml.Append("</td>"); menuHtml.Append("<td width='739' valign='middle' align='right' style='height: 30px;'>"); foreach (DataRow dr in dtMenu.Rows) { if (dr["MenuName"].ToString() == "Profile") { menuHtml.Append("<img src='http://stackoverflow.com/images/home_icon.jpg' width='25' height='25' align='middle' /><a href='http://stackoverflow.com/questions/13800030/AllProfile.aspx>Profile</a> "); } else if (dr["MenuName"].ToString() == "User") { menuHtml.Append("<img src='http://stackoverflow.com/images/home_icon.jpg' width='25' height='25' align='middle' /><a href='http://stackoverflow.com/questions/13800030/AllUsers.aspx>User</a> "); } } menuHtml.Append("</td>"); menuHtml.Append("</tr>"); menuHtml.Append("</table>"); } lblMenu.Text = menuHtml.ToString(); } }\[/code\]When i load the page i only see a html code printed as text and not rendering.Can any one point out what may be wrong
 
Back
Top