Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 18th, 2006, 02:13 PM
Authorized User
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic checkbox and radiobutton lists

I am using C#.NET and want to have dynamically created checkboxes and radio buttons. My database connection is hardcoded in (not using the .NET connection) and I want to retrieve information from the database, display it in either a checkbox list, or a radio button list, and allow users to check or click their choice. It is easy enough to set up either list, but I do not know how to populate them from a database. Any help or hints would be welcome.

Old April 5th, 2006, 05:04 AM
Registered User
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Hi !

this example works with a panel

1/ Create table like this :
System.Controls.Checkbox CheckTable[];
2/ instanciations
CheckTable = new Checkbox[number_checkbox];
3/ populate table, in "while" or "for" as you like
int counter=0;
int beginning=8; //used for location
while ...
CheckTable[counter] = new Checkbox();
CheckTable[counter].Text = Text_to_show;
CheckTable[counter].Location=new System.Drawing.Point(8,depart);*
CheckTable[counter].Size=new Size(16,15);
CheckTable[counter].CheckedChanged += new System.EventHandler(this.Check_CheckedChanged);
depart += 24;

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with dynamic drop down lists MarkGT Classic ASP Basics 3 April 29th, 2008 06:05 PM
Dynamic Radiobutton inside Templatefield carthic143 ASP.NET 1.0 and 1.1 Basics 0 January 5th, 2008 07:33 AM
Dynamic checkbox and radiobutton lists Ric_H General .NET 2 March 30th, 2006 01:52 PM
Dynamic check boxes and select lists bsheridan Classic ASP Basics 1 March 17th, 2006 05:39 AM
Help - Dynamic Pop-down lists phpcoder1 PHP How-To 0 November 8th, 2004 12:02 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.