Note that there are some explanatory texts on larger screens.

plurals
  1. POHiding a link in asp.net
    primarykey
    data
    text
    <blockquote> <p><strong>Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1705152/hiding-a-link-in-asp-net">Hiding a link in asp.net</a> </p> </blockquote> <hr> <p>Hi this is the cs file of the masterpage...</p> <pre><code>using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace LevoContactManagement { public partial class Default : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { BasePage page = (BasePage)Page; if (page.CurrentUser != null) { lblCurrentUser.Text = "&lt;strong&gt;" + page.CurrentUser.FullName + "&lt;/strong&gt; - " + page.CurrentUser.CompanyName; if ((Session["CCFUser"] != null) &amp;&amp; (bool.Parse(Session["CCFUser"].ToString()) == true)) { ctrlLinkBar.AddLink("Issues Management", "AllIssues.aspx"); } else { if (true) ctrlLinkBar.AddLink("Home", "Default.aspx"); if (page.CurrentUser.Permissions.Issues()) ctrlLinkBar.AddLink("Issues Management", "AllIssues.aspx"); if (page.CurrentUser.Permissions.Time()) ctrlLinkBar.AddLink( "Time Management", "TimeEntryForm.aspx"); if (page.CurrentUser.Permissions.Time()) ctrlLinkBar.AddLink("Time Filter", "TimeFilter.aspx"); if (page.CurrentUser.Permissions.SVN() &amp;&amp; !(this.Page is _Default)) ctrlLinkBar.AddLink("SVN", "SVN.aspx"); if (true) ctrlLinkBar.AddLink("Profile", "ChangePassword.aspx"); if (page.CurrentUser.Permissions.Administration()) ctrlLinkBar.AddLink( "Administration", "Administration.aspx"); } } else lnkLogout.Visible = false; } protected void lnkLogout_Click(object sender, EventArgs e) { Session.Abandon(); FormsAuthentication.SignOut(); Response.Redirect("Login.aspx"); } } } </code></pre> <p>i need to make the link Time Filter hidden. the cs file of LinkBar is</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebControlLib { [ToolboxData("&lt;{0}:LinkBar runat=server&gt;&lt;/{0}:LinkBar&gt;")] public class LinkBar : WebControl { struct Link { public string Title; public string URL; public override string ToString() { return "&lt;a href='" + URL + "'&gt;" + Title + "&lt;/a&gt;"; } } private bool m_bIsVertical = false; private List&lt;Link&gt; m_Links = new List&lt;Link&gt;(); public bool IsVertical { get { return m_bIsVertical; } set { m_bIsVertical = value; } } public void Clear() { m_Links.Clear(); } public void AddLink(string Title, string URL) { Link lnk = new Link(); lnk.Title = Title; lnk.URL = URL; m_Links.Add(lnk); } protected override void RenderContents(HtmlTextWriter output) { List&lt;string&gt; items = new List&lt;string&gt;(); foreach (Link lnk in m_Links) items.Add(lnk.ToString()); string sep = IsVertical ? "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;" : " | "; output.Write( @" &lt;table width='100%' class='linkBar'&gt; &lt;tr&gt; &lt;td&gt;" + string.Join(sep, items.ToArray()) + @"&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; "); } } } </code></pre> <p>how do i go about it? i changed the master.designer.cs file as follows--></p> <pre><code> public partial class Default { protected System.Web.UI.HtmlControls.HtmlForm form1; protected System.Web.UI.WebControls.Label lblCurrentUser; protected System.Web.UI.WebControls.LinkButton lnkLogout; public WebControlLib.LinkBar ctrlLinkBar; public System.Web.UI.WebControls.ContentPlaceHolder LeftNav; protected System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder1; protected System.Web.UI.WebControls.ContentPlaceHolder BodyContent; } </code></pre> <p>but the link still does not appear on the Design view of the masterpage, hence i cant find the id, therefore i cant hide it. What is an alternative to this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload