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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:32:54+00:00 2026-05-26T05:32:54+00:00

I have a gridview taking data from object data source. The object data source

  • 0

I have a gridview taking data from object data source. The object data source is taking data from a method which takes one parameter (string). The parameter is supplied from page url using querystring, and the default value is set to null. In the method taking parameter, I am trying to check if the parameter is null return all data else return data
with id got from the parameter – eg. code.

public list<string> MyMethod (string param)
    {
        if(param == null)
    {
       return // all
    }
    else
    {
       return // id with param
    }
    }

I tried to debug the program and the param is actually null but the if () statement is always going to “false” condition. i.e. param == null always evaluating to false. I tried String.IsNullorEmpty(param), and it still is evaluating to false. I don’t understand what the problem is. Please help.
Many Thanks.

enter image description here

  • 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-26T05:32:55+00:00Added an answer on May 26, 2026 at 5:32 am

    Have you tried stepping through and debugging (assuming you’re using visual studio)?

    Put a breakpoint on your method signature and then hover over with your mouse on the param variable to see what it’s value is after each step.

    Debugging will help you identify the source of issues like this pretty fast.

    Edit

    The screenshot you added shows your param variable is equal to the string “null”, not null.

    You can change your if statement to if(param == “null”) and that should work, but the real fix for this is most likely to not use the string “null” at all so that’ll require editing wherever you assign the variable you pass to the function.

    Also, your code sample is param == null yet your screenshot is param != null. The != means not equal, I’m not sure if that’s just a typo or you haven’t noticed.

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

Sidebar

Related Questions

I have GridView that allows select. It takes data from EntityDataSource . How do
I have a GridView where one column is bound to an object property containing
I have a gridview that takes in values from a sortedlist. I want to
I have one page (Products) that searches for products which are then displayed in
I have gridview column 'Assignment Result' which is bound to data column status. How
I have a gridview which shows all the information of the data table. I
I have gridview, it's datasource is list<string> and I added one checkbox column to
I have gridview, when I connect the sqldatasource and run the application, data from
I have GridView which I can select a row. I then have a button
Have a gridview control which will show X amount of rows. I want to

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.