By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,569 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,569 IT Pros & Developers. It's quick & easy.

Displaying Checkbox results

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Nov 21 '05 #2

P: n/a
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
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.