I can feed the info into the user control to dynamicly add the check boxes, I cant get this checked info back out. When I check them, they all show as not checked. I have dragged and dropped the UC on the aspx page as well as add it dynamicly - nothing works.
Here is the code in the UC (_CheckedBoxList is where I am trying to do the info to, so I can find it in the aspx.page. The cblfacilititems.Items contains all the check boxes but they are all in the list as unchecked, when I checked them.)
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
cblfacilititems.DataSource = _AllCheckBoxList
cblfacilititems.DataValueField = "Value"
cblfacilititems.DataTextField = "Text"
cblfacilititems.DataBind()
Else
_CheckedBoxList = (From MenuItem As ListItem In cblfacilititems.Items
Where MenuItem.Selected
Select MenuItem.Value).ToList
End If
End Sub
Member
22 Points
118 Posts
CheckBoxList in UC not working as expected
Sep 09, 2016 07:19 PM|Go2Greece|LINK
I can feed the info into the user control to dynamicly add the check boxes, I cant get this checked info back out. When I check them, they all show as not checked. I have dragged and dropped the UC on the aspx page as well as add it dynamicly - nothing works.
Here is the code in the UC (_CheckedBoxList is where I am trying to do the info to, so I can find it in the aspx.page. The cblfacilititems.Items contains all the check boxes but they are all in the list as unchecked, when I checked them.)
At the moment, it is on the page like this
The button is on the page and not in the UC
In the code behind I do this
The above always shows "0" because my Where MenuItem.Selected never finds any checked boxes, buyt they are checked
I did try all day and I think I have tryed most things I can think off, but I cant get to returned the checked boxes from the UC to the UI page
Any help will be great
Graham
Contributor
6311 Points
1694 Posts
Re: CheckBoxList in UC not working as expected
Sep 12, 2016 10:31 AM|Brando ZWZ|LINK
Hi Go2Greece,
According to your description, I couldn't reproduce your issue on my computer.
Could you please post more relevant codes about "WebSiteFacilitiesAdmin.ascx" and it code-behind?
Is AllCheckBoxList a property in the user control?
If you could post more codes, it will be more easily for us to reproduce the issue and find the solution.
Best Regards,
Brando