trevoray
asked on
bound checkbox list and setting one of the checkboxes to read only
hi all,
i have a bound check box list that i want to dynamically change the appearance/format of 1 to all of the checkboxes depending upon other data.
It is a list of payment options like so:
x Widget 9
x Gadget 11
x Part 14
x Piece 15
x Ratchet 12
If the user has already made a payment for one of these items then i want the listitem text to be different and the checkbox to either be unavailable or set to read only, so that when the page loads it will look like this:
x Widget 9
x Gadget 11 - PAID
x Part 14
x Piece 15 - PAID
x Ratchet 12
I know i will have to set this in the code behind.
Is this possible? Can someone show me how i might do this?
In VB please!
Thanks!!
- trevor
i have a bound check box list that i want to dynamically change the appearance/format of 1 to all of the checkboxes depending upon other data.
It is a list of payment options like so:
x Widget 9
x Gadget 11
x Part 14
x Piece 15
x Ratchet 12
If the user has already made a payment for one of these items then i want the listitem text to be different and the checkbox to either be unavailable or set to read only, so that when the page loads it will look like this:
x Widget 9
x Gadget 11 - PAID
x Part 14
x Piece 15 - PAID
x Ratchet 12
I know i will have to set this in the code behind.
Is this possible? Can someone show me how i might do this?
In VB please!
Thanks!!
- trevor
You may not be able to do it by using bound control. You will have to populate the list manually by creating the ListItem for each data item and then modifying the text depending if PAID or not status.
ASKER
ok, so let's say i don't bind it, but enter in all the widget types manually, how would i access an individual item in the code behind?
dim strgadget11 AS STRING
If such and such is true then strgadget11 = 'true'
If strgadget11 = 'true' then listitem.gadget11.text = "gadget 11 - PAID"
??
thanks!
dim strgadget11 AS STRING
If such and such is true then strgadget11 = 'true'
If strgadget11 = 'true' then listitem.gadget11.text = "gadget 11 - PAID"
??
thanks!
DO you mean accessing what checkboxes have been cheked or how to populate them..
You access each item by index... or you can use For Each syntax to get to each item in the list control.
Dim myList As ListBox
Dim myItem1 As ListItem = myList(0)
Something like that..
You access each item by index... or you can use For Each syntax to get to each item in the list control.
Dim myList As ListBox
Dim myItem1 As ListItem = myList(0)
Something like that..
ASKER
no, not accessing which checkboxes have been checked. assessing data in the database, seeing if they have already paid for their widget some time ago, and if the have, then doing like illustrated above and also making the checkbox 'disabled' or 'read-only'
so, i don't need to search and find out the criteria of the checkboxes, but rather the opposite, dynamically set the criteria for each checkbox. would the best way be to just build the whole list in the behind code? :(
so, i don't need to search and find out the criteria of the checkboxes, but rather the opposite, dynamically set the criteria for each checkbox. would the best way be to just build the whole list in the behind code? :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.