Displaying Checkbox results

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

    Displaying Checkbox results

    Hi, I am creating a web feedback form that has a both a checkbox and
    listbox on it that are both databound to a database. I have been
    researching all day and have found multiple answers for displaying the
    results, but none of them work with databound checkbox lists. My
    current code is:
    Sub Check_Clicked(s ender as Object, e As EventArgs)
    lblPropTypes.Te xt = "Selected Item(s):<br><br >"
    Dim i As Integer
    For i=0 To cblPropTypes.It ems.Count - 1
    If cblPropTypes.It ems(i).Selected Then
    lblPropTypes.Te xt += cblPropTypes.It ems(i).Text & ", "
    End If
    Next
    End Sub

    <asp:CheckBoxLi st id="cblPropType s" runat="server"
    datavaluefield= "Class" datatextfield=" Class"
    OnSelectedIndex Changed="Check_ Clicked"></asp:CheckBoxLis t>

    Thanks in advance for any help!!
    -Cabellm

  • cabellm

    #2
    Re: Displaying Checkbox results

    Actually I got part of this problem solved. I changed the databind
    function to make sure it was only when the page was not post back. I
    still cannot get my listbox to work though so any help would be great.
    -Cabell

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Displaying Checkbox results

      Cabelm,

      Be aware that you have with a webpage to restore the datasource. By instance
      like this in the load part of your page

      \\\
      if Not IsPostBack then
      Get your dataset as ds
      Session.Item("d s")=ds
      else
      ds = DirectCast(Sess ion.Item("ds"), Dataset)
      End if
      ///

      And don't forget to databind as last action before the sent back to the
      client.

      I hope this helps,

      Cor


      Comment

      Working...