asp.net 2.0 can't access control values when inside hidden div

Hello

I am using asp.net 2.0 and I have a chekc box list which is inside a jquery pop up box. I cannot access the values of the chekc box list in the code behind. It seems as if they are lost or empty even though some of the values are checked. I presume this is because they are in a hidden div on the client.

Is there anything I can do to fix this? I coudl do something on the client side to add the checkbox values to a hidden variable but I'd rather just be able to access them in the code behind

thanks a lot
andiejeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

unknown_routineCommented:
Can you access the checkobx list object in the code behind?

If no you need to declare that checkboxlist with the same ID as HTML in the code behind modlue.(declare as protected)
0
guru_samiCommented:
And may be sharing some code would help as well.
0
andiejeAuthor Commented:
Yes i can access the checkbox list in the code behind. The problem is that the selected items are not accessible. I iterate through these in a function but they are coming back as empty strings.

Public Function GetCommaSeparatedListOfGeofencesForSP(ByVal cblGeofences As CheckBoxList)
        Dim regList As String = String.Empty
        Dim getAll As Boolean = False

        For Each item As ListItem In cblGeofences.Items
            If item.Selected Or getAll = True Then
                If item.Value = "All" Then
                    getAll = True
                Else
                    If regList = String.Empty Then
                        regList = String.Format("{0}", item.Value)
                    Else
                        regList = String.Format("{0},{1}", regList, item.Value)
                    End If
                End If

            End If
        Next

        Return regList
    End Function

Open in new window


I get a string error saying the index must be within the string suggesting the string is empty. If i take the checkbox list out of the hidden div everything is fine
0
guru_samiCommented:
Putting it inside a hidden div shouldn't make a difference. May be something else is missing.
- What kind of popup is it?
- Are you sure you are not doing anything with the CBL in the pageLoad?

Here's a sample demo.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.