How to make DropDownList display "No Result"?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 7effrey
    New Member
    • Feb 2008
    • 12

    How to make DropDownList display "No Result"?

    Hi i was just wondering how i should do this:

    I have a dropdownlist and a datalist. The datalist will be displayed when a value is selected from the dropdownlist. But if there are no results for the selected value in the dropdownlist the page is blank.

    How do i make a message like : "No results" or something like that instead of just pure blank page?

    thank you for your time, I appreciate it!
  • 7effrey
    New Member
    • Feb 2008
    • 12

    #2
    Originally posted by 7effrey
    Hi i was just wondering how i should do this:

    I have a dropdownlist and a datalist. The datalist will be displayed when a value is selected from the dropdownlist. But if there are no results for the selected value in the dropdownlist the page is blank.

    How do i make a message like : "No results" or something like that instead of just pure blank page?

    thank you for your time, I appreciate it!
    I solved it by this:
    Code:
    if (DropDownList.Items.Count == 0){
      NoResult.Text = "No records found";
    }
    Last edited by Frinavale; May 3 '10, 08:40 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      I'm glad you solved your problem :)
      Thanks for sharing the solution with us so that others facing the same problem can get help.

      -Frinny

      Comment

      Working...