views:

68

answers:

3

hi, in the following master.cs code.....

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 = "<strong>" + page.CurrentUser.FullName + "</strong> - " + page.CurrentUser.CompanyName;

            if ((Session["CCFUser"] != null) && (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() && !(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");
    }
}

i need to hide the link "Time Filter" so it doesnt appear on any of the web content forms. It doesnt have an id so i cannot caste it. How do I go about hiding it then?

A: 

How about editing Master.cs to not add it, or only add it some of the time?

If that doesn't work, then you need to give us more context.

Tom Ritter
A: 

Why not make ctrlLinkBar.AddLink take an Id in its constructor and create the link with an Id?

ctrlLinkBar.AddLink("TimeFilterId", "Time Filter", "TimeFilter.aspx");

Then, your content pages or whatever can find it and hide when needed.

rick schott
I tried that. But I am getting an erroe "no overload for method "AddLink" takes 3 arguments".
Sophie
What is ctrlLinkBar? I assumed it was something you wrote.
rick schott
A: 

Am I missing something? Why not just delete the line?

if (page.CurrentUser.Permissions.Time()) 
  ctrlLinkBar.AddLink("Time Filter", "TimeFilter.aspx");
Steve Cooper