hi all. i've been doing a checkbox that is controlled by bitmaps.
it is successful when i checked the check box and updated it. but it is not successful when i try to uncheck and update it. it will be as if it was checked like before.

below is my coding

Dim ItemCount As Integer = 3
        Dim Total As Integer = 0

        For i = 0 To ItemCount
                   Dim chk As CheckBox = Page.FindControl("cb" & StringValue & i.ToString)
            If chk.Checked Then
              
                Total = Total + RefNo(i)

            End If

        Next i

        Return Total

thanks

is my question too confusing?

does u r code compile correctly..?

cos i'm a C# coder if i'm at ur place...

i need to typecast the things before referencing any checkbox on the page ...

if u r code complies correctly then wot is error u get...elaborate please.. may be i can help...

hi all. i've been doing a checkbox that is controlled by bitmaps.
it is successful when i checked the check box and updated it. but it is not successful when i try to uncheck and update it. it will be as if it was checked like before.

below is my coding

Dim ItemCount As Integer = 3
        Dim Total As Integer = 0

        For i = 0 To ItemCount
                   Dim chk As CheckBox = Page.FindControl("cb" & StringValue & i.ToString)
            If chk.Checked Then
              
                Total = Total + RefNo(i)

            End If

        Next i

        Return Total

thanks

Your question is not clear.

You are summing up some values for the checked items. Also you posted the code segment partially. What do you expect for the uncheck items ?

what i am trying to do is to total up the value of all the checkboxes. but when it is checked it is updates successfully.

but when i display all of the checkboxes again and want to uncheck certain boxes the value will still be as if it was checked.

does u r code compile correctly..?

cos i'm a C# coder if i'm at ur place...

i need to typecast the things before referencing any checkbox on the page ...

if u r code complies correctly then wot is error u get...elaborate please.. may be i can help...

yes...all the compilation is ok. no errors. just that when i want to uncheck it won't update into the server. the bitmap is calculated as if it is checked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.