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 8350817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:26:18+00:00 2026-06-09T08:26:18+00:00

I have programmatically bind repeater in my code behind file. I am also checking

  • 0

I have programmatically bind repeater in my code behind file. I am also checking for roles in my page like below and according to that I am binding my repeater control like this;

if (Page.User.IsInRole("Admin"))
{
    repeaterArticlesList.DataSource = ArticleAccess.GetArticlesWithNoPaginate();
    repeaterArticlesList.DataBind();
}
else if(Page.User.IsInRole("Editor"))
{
    repeaterArticlesList.DataSource = ArticleAccess.GetArticlesWithNoPaginate();
    repeaterArticlesList.DataBind();
}
else 
{
    string userName = Page.User.Identity.Name.ToString();
    repeaterArticlesList.DataSource = ArticleAccess.GetArticlesWithNoPaginateWithUsername(userName);
    repeaterArticlesList.DataBind();
}

I have total 4 roles i-e Admin, Author, Editor, User. However, I have one user i-e admin which belongs to all of these roles.
The problem with my logic is that when I logged in as an admin user (which belongs to all 4 roles), the first condition and the second condition both fails and the last one is executed.
So, I want to execute my first condition for that user which must be in all of my roles 4 roles.
Otherwise then I will check for individual roles.
Any help regard to this is appreciated in advance.

  • 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-06-09T08:26:20+00:00Added an answer on June 9, 2026 at 8:26 am

    You could do something like:

    var userRoles = Roles.GetRolesForUser(userName);
    var rolesNotAssigned = Roles.GetAllRoles().Except(userRoles);
    if (rolesNotAssigned.Length == 0)
    {
        // user is in all roles   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some Javascript code that will programmatically register an COM interop assembly by
I have UIScrollView which i populate with UIImageViews programmatically. After that I change contentSize
I have my ipad code created programmatically not using nib.I converted my ipad app
I have added a UILabel to my view programmatically like this: myLabel = [[UILabel
I have a custom tableview cell created programmatically that consists of: a background view
Early warning - code sample a little long... I have a singleton NSMutableArray that
I have a gridview that is bind to the datatable. how to programmaticaly change
I have a tab bar controller that I have created programmatically, named TPastJourneyTabbar .
What is the best way to close an ASPX page from the code-behind? I
I would like to be able to programmatically bind some data to the dependency

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.