Quick Database/checklist Question

Last post 04-25-2008 6:38 PM by RyanSJedi. 2 replies.

Sort Posts:

  • Quick Database/checklist Question

    04-25-2008, 5:13 PM
    • Loading...
    • kmj2384
    • Joined on 03-31-2008, 11:59 PM
    • Posts 160

    I'm trying to add a checklist to one of my webforms.  However, whenever I test the form and check the database, only the first option I checked appears in the database.

    I'm assuming this has something to do with the PropertyName field.  For instance, I know for a textbox I can use PropertyName="Text" or drop down list PropertyName="SelectedValue"

    Is there some sort of PropertyName that refers to a checklist so I can get all the items that were checked into the database?  Thanks.

    Also, I am using the ASP.NET checkboxlist control.

    Thank you.

  • Re: Quick Database/checklist Question

    04-25-2008, 6:36 PM
    Answer
    • Loading...
    • jonahpup
    • Joined on 11-27-2006, 9:08 AM
    • Posts 11

    I find the easiest way to get around this (cause asp does all the work for you) is to use <asp:CheckBoxList>

  • Re: Quick Database/checklist Question

    04-25-2008, 6:38 PM
    Answer
    • Loading...
    • RyanSJedi
    • Joined on 03-01-2006, 5:38 PM
    • Posts 249

    Since the checkboxlist control is a collection you need to loop through it to get the values of the individual check boxes kinda like this (this is pseudo code and not checked for syntax errors)

    foreach(ListItem li in mycheckboxlist)

    {

        myvalue = li.value;

    }

    Hope that helps

    Flames are for BBQ'ing.
    http://weblogs.asp.net/RyanSmith
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter