?
Solved

bound checkbox list and setting one of the checkboxes to read only

Posted on 2003-10-21
5
Medium Priority
?
1,306 Views
Last Modified: 2008-02-26
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
0
Comment
Question by:trevoray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 9593719
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.
0
 

Author Comment

by:trevoray
ID: 9593758
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!
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 9593785
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..
0
 

Author Comment

by:trevoray
ID: 9593938
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?  :(
0
 
LVL 23

Accepted Solution

by:
naveenkohli earned 2000 total points
ID: 9594001
Best would be to build the list manually in code behind. Just add the control on the page and then on load time add the items to it.
You must have some field in the table that tells you if status is PAID or not.

here is small pseudo code [sorry its C#]

foreach (DataRow row in myTable.Rows)
{
  ListItem item = new ListItem();
   string strText = row["desc"];
   if (Convert.ToBoolean(row["status"]))
   {
      strText += " - PAID";
   }

   item.Text = strText;
   myList.Items.Add(item);
}
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question