Shopping Cart checkboxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wbosw
    New Member
    • Mar 2007
    • 36

    Shopping Cart checkboxes

    I'm trying to create a simple shopping cart, so when the multiple checkboxes on the UI are checked the objects are added to the database. My question is how would I handle checking to see which checkboxes are checked from the multiple checkboxes and what is the best method of saving the objects to storage.
  • programmerboy
    New Member
    • Jul 2007
    • 84

    #2
    Originally posted by wbosw
    I'm trying to create a simple shopping cart, so when the multiple checkboxes on the UI are checked the objects are added to the database. My question is how would I handle checking to see which checkboxes are checked from the multiple checkboxes and what is the best method of saving the objects to storage.
    I hope you are using vb.net. Here is something you can try using.

    [CODE=vbnet]Dim ctrlCol As ControlCollecti on = Me.Controls
    Dim count x As Integer
    Dim strChkBoxText,s trChkBoxName as String
    Dim checked as boolean
    count = ctrlCol.Count

    For x = 0 To count - 1
    ctl = ctrlCol.Item(x)
    If TypeOf (ctl) Is CheckBox Then
    Dim a As CheckBox
    a = CType(ctl, CheckBox)

    ctl.Text = "" 'will set the text for that control
    strChkBoxText = ctl.Text 'will get the text for that control
    strChkBoxName = ctl.Name 'will get the text for that control
    checked = aCheckBox.check d 'will check if checkbox is checked
    End If
    Next x[/CODE]

    Comment

    • wbosw
      New Member
      • Mar 2007
      • 36

      #3
      I'm using C#, but I will look this over carefully to see if I can covert the code.

      Thanks,
      wbosw

      Comment

      • wbosw
        New Member
        • Mar 2007
        • 36

        #4
        Originally posted by programmerboy
        I hope you are using vb.net. Here is something you can try using.

        [CODE=vbnet]Dim ctrlCol As ControlCollecti on = Me.Controls
        Dim count x As Integer
        Dim strChkBoxText,s trChkBoxName as String
        Dim checked as boolean
        count = ctrlCol.Count

        For x = 0 To count - 1
        ctl = ctrlCol.Item(x)
        If TypeOf (ctl) Is CheckBox Then
        Dim a As CheckBox
        a = CType(ctl, CheckBox)

        ctl.Text = "" 'will set the text for that control
        strChkBoxText = ctl.Text 'will get the text for that control
        strChkBoxName = ctl.Name 'will get the text for that control
        checked = aCheckBox.check d 'will check if checkbox is checked
        End If
        Next x[/CODE]





        I'm using C#, but I will look this over carefully to see if I can covert the code.

        Thanks,
        wbosw

        Comment

        Working...