Detecting empty CheckBoxList without data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dbuchanan

    Detecting empty CheckBoxList without data

    How, at rundime, do I capture the fact that the parametrized query that
    fills a CheckBoxList results in an empty set. When the dataset is empty the
    CheckBoxList does not appear. I would like to properly inform the user of
    the fact.

    How is ths done?

    Thank you,
    Doug


  • Steven Cheng [MSFT]

    #2
    RE: Detecting empty CheckBoxList without data

    Hi Doug,

    Is this issue and continous one from the previous checkbox list query one?
    I think you've now be able to query the data based on the checkboxlist's
    selection status, and your current difficulty is how to do some
    customization on the page depend on whether the returened query result is
    empty or not, correct?

    If this is the case, would you show me the code on how to query the result
    and how to bind it to the databound control(DataGri d or Gridview) or are
    you still using a SqlDataSource control?

    If you are programmtically call ADO.NET SqlCommand or TableAdapdter to get
    the DataSet, I think you can set the CheckBoxList.Vi sible to false in your
    code after check whether the returned DataTable is empty.

    If you're using SqlDataSource control, I think you may register its
    "Selected" event, and use the "AffectedRo ws" parameter propertyto determine
    whether there is any row get returned. e.g.

    ===============
    protected void SqlDataSource1_ Selected(object sender,
    SqlDataSourceSt atusEventArgs e)
    {
    Response.Write( "<br/>AffectedRows : " + e.AffectedRows) ;
    }
    =============== ==

    If there is anything I have omited or if you have any parituclar
    requirement, please feel free to post here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    Gain technical skills through documentation and training, earn certifications and connect with the community

    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscripti...t/default.aspx.
    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    >From: "dbuchanan" <dbuchanan@news group.nospam>
    >Subject: Detecting empty CheckBoxList without data
    >Date: Thu, 12 Jun 2008 01:12:38 -0400
    >
    >How, at rundime, do I capture the fact that the parametrized query that
    >fills a CheckBoxList results in an empty set. When the dataset is empty
    the
    >CheckBoxList does not appear. I would like to properly inform the user of
    >the fact.
    >
    >How is ths done?
    >
    >Thank you,
    >Doug
    >
    >
    >

    Comment

    • dbuchanan

      #3
      Re: Detecting empty CheckBoxList without data

      Thank you Steve this works great.

      Doug


      Comment

      • Steven Cheng [MSFT]

        #4
        Re: Detecting empty CheckBoxList without data

        You're welcome Doug,

        Sincerely,

        Steven Cheng

        Microsoft MSDN Online Support Lead


        Delighting our customers is our #1 priority. We welcome your comments and
        suggestions about how we can improve the support we provide to you. Please
        feel free to let my manager know what you think of the level of service
        provided. You can send feedback directly to my manager at:
        msdnmg@microsof t.com.

        =============== =============== =============== =====
        Get notification to my posts through email? Please refer to
        Gain technical skills through documentation and training, earn certifications and connect with the community

        ications.

        =============== =============== =============== =====
        This posting is provided "AS IS" with no warranties, and confers no rights.

        --------------------
        >From: "dbuchanan" <dbuchanan@news group.nospam>
        >References: <#2O#CqEzIHA.40 40@TK2MSFTNGP04 .phx.gbl>
        <i9GI#mFzIHA.17 84@TK2MSFTNGHUB 02.phx.gbl>
        >Subject: Re: Detecting empty CheckBoxList without data
        >Date: Fri, 13 Jun 2008 14:55:58 -0400
        >
        >Thank you Steve this works great.
        >
        >Doug
        >
        >
        >

        Comment

        Working...