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

  • SEARCH
  • Home
  • 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 6906757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:21:02+00:00 2026-05-27T08:21:02+00:00

My situation is like this: I have a function that returns a value as

  • 0

My situation is like this:

I have a function that returns a value as SPListItemCollection and I bind this function to a repeater.
My problem is how can I do some conditional formatting before the return value?

SPListItemCollection GetListItems()
{
SPWeb curWeb = SPContext.Current.Site.RootWeb;
string siteUrl = SPContext.Current.Web.Url;
SPListItemCollection curItems = GetDep(ListName, department);
// write condition here so that it checks if the item count is higher or 
//lower than a specified number.

return curItems;
}

thank you for your help.

  • 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-27T08:21:03+00:00Added an answer on May 27, 2026 at 8:21 am

    Im not 100% sure what you want to do before the return. If you only want to check if the resultItem.Count is bigger then 100 for example, you can do this:

        SPListItemCollection GetListItems()
        {
            SPWeb curWeb = SPContext.Current.Site.RootWeb;
            string siteUrl = SPContext.Current.Web.Url;
            SPListItemCollection curItems = GetDep(ListName, department);
    
            if (curItems.Count > 100)
            {
                // change the items or do whatever you want. after that, return:
                foreach(SPListItem item in curItems)
                {
                    //format/change
                }
                return curItems;
            }
            // return, without any changes
            return curItems;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation. I have some javascript that looks like this: function onSubmit()
Say you have a value like this: n = 5 and a function that
Imagine such situation that I have a function like this: Object f() { Object
Anybody have any ideas? The situation is like this: I have a primary rails
i have situation like this: class IData { virtual void get() = 0; virtual
I have situation like this: user submits form with action='/pay' in '/pay' I have
I haven't been able to find anything for a situation like this. I have
Hi this may seem like a weird question, but here's my situation: I have
I have a method that queues some work to be executed asynchronously. I'd like
Hi I Have a situation like this. I have to populate 2 labels and

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.