Displaying Checkbox results

  • Thread starter Thread starter cabellm
  • Start date Start date
C

cabellm

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(sender as Object, e As EventArgs)
lblPropTypes.Text = "Selected Item(s):<br><br>"
Dim i As Integer
For i=0 To cblPropTypes.Items.Count - 1
If cblPropTypes.Items(i).Selected Then
lblPropTypes.Text += cblPropTypes.Items(i).Text & ", "
End If
Next
End Sub

<asp:CheckBoxList id="cblPropTypes" runat="server"
datavaluefield="Class" datatextfield="Class"
OnSelectedIndexChanged="Check_Clicked"></asp:CheckBoxList>

Thanks in advance for any help!!
-Cabellm
 
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
 
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("ds")=ds
else
ds = DirectCast(Session.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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top