Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 221919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:04:43+00:00 2026-05-11T19:04:43+00:00

I’m using a public variable called IsAdmin in the code behind of an aspx

  • 0

I’m using a public variable called IsAdmin in the code behind of an aspx page.

 public partial class _news : System.Web.UI.Page
{
    public bool IsAdmin = false;
    protected void Page_Load(object sender, EventArgs e)
    {

    if (User.Identity.Name.Contains("admin"))
    {
        IsAdmin = true;
    }
    else
    {
        IsAdmin = false;
    }
 }

And i use the property Visible='<%#IsAdmin%>’ to assign to panels which i want to show if the user is an admin in the aspx design of the page. Strangely it works for the linkbuttons i’ve put on the repeater.

 <asp:Panel ID="Panel1" runat="server" Visible='<%#IsAdmin%>'>
 <asp:LinkButton ID="LinkButton2" runat="server" PostBackUrl='<%# "news_edit.aspx?     Action=edit&id=" + Convert.ToString( Eval("news_id")) %>Edit</asp:LinkButton>

 <asp:LinkButton ID="LinkButton3" runat="server" PostBackUrl='<%# "news.aspx?Action=delete&id=" + Convert.ToString( Eval("news_id")) %>'>Delete</asp:LinkButton>
        </asp:Panel>

and it works fine, however outside the repeater i’ve put another linkbutton without a panel

 <asp:LinkButton ID="LinkButton4" runat="server" PostBackUrl="~/news_edit.aspx?action=new" Visible='<%#IsAdmin%>'>Add New Item</asp:LinkButton>

but the visible property doesn’t work on it! I tried putting it inside a panel too and setting it’s visible property but that too didn’t work.

So i have following doubts

1)what is the issue?
2)what is the technical name when we use references like ‘<%#IsAdmin%>’ in the design page
3)Does page load happen before page is rendered of after page is rendered?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:04:44+00:00Added an answer on May 11, 2026 at 7:04 pm

    <%# %> is the syntax used for accessing databound fields. Since you are likely databinding the Repeater control at some point, these expressions will be evaluated.

    Since you are likely not calling databind on the Panel and the Linkbuttons outside of the Repeater, these expressions will not be processed. You can probably change them to something like

    <%= IsAdmin.ToString() %>
    

    and get the result you want.

    Check this great blog entry for more information on the differences.

    Also, Page Load happens before the page is rendered. Rendering the page is the last thing that happens in the ASP.Net page lifecycle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 101k
  • Answers 101k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have figured out where i was going wrong! This:… May 11, 2026 at 8:04 pm
  • Editorial Team
    Editorial Team added an answer As I discovered a solution myself I will answer my… May 11, 2026 at 8:04 pm
  • Editorial Team
    Editorial Team added an answer I strongly suggest that reflection-mojo should be avoided here. A… May 11, 2026 at 8:04 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.