Results 1 to 4 of 4

Thread: Request.Form CheckBoxList

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Request.Form CheckBoxList

    On my webpage their is a userwebcontrol that contains a checkboxlist.
    im tryin to retrieve the checked values of this list using
    Request.Form("ct100$TreatmentsCheckList")

    but this returns nothing...

    is their anyway to get the selected items
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Re: Request.Form CheckBoxList

    Create a property in your UserControl that will return a collection of checked items. Loop through them, do whatever you need to do after.

  3. #3

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: Request.Form CheckBoxList

    hi serge, could you give me an example what you are talking about.
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Request.Form CheckBoxList

    It means that you need to expose your checkbox list items.

    So, you'd have something like

    MyControlName.SelectedTreatments

    You would access it from the parent page. Your control in turn would have a bit of logic in the get part for this public property. (SelectedTreatments is going to be your public property inside the user control)

    That logic would need to loop through the actual control and find out what's checked and return those values.

    Code:
    public List<string> SelectedTreatments
    {
    get
    {
    //Loop through the checkboxlist and find out which ones are selected, add them to your list of strings or whatever type you want.
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width