Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 October 12th, 2006, 06:47 AM
Authorized User
 
Join Date: Oct 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default creating checkboxes at runtime

hi, i want to create multiple checkboxes at run time....
i want to write some code so that when my program runs that no. of checkboxes shld be created....
any help would be great.
thanx in advance......

 
Old October 12th, 2006, 07:06 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey

Creating checkboxes at runtime is not a big deal, but please specify where and in which situation you need these checkboxes, a bit clarity on this issue is needed

Regards
Mike
 
Old October 12th, 2006, 07:25 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

As mike said, this is a trivial matter but we do need more of an explination as to how you want to implement this.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old November 3rd, 2006, 02:12 AM
Authorized User
 
Join Date: Oct 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

k fine
im working in asp.net with vb language
what i want to try is to create a loop for creating checkboxes at run time
is it possible as i dnt want my database to come into the action?
ex:-
for( )
{
some code
}
n at runtime as many as i have mentioned that no. of checkboxes are created
plz reply as any help would be gr8
thnx in advance

 
Old November 3rd, 2006, 02:39 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

As said in the earlier posts by me and parsons, this can be achieved easily, just look at the code below where I have created checkboxes at runtime and added them to a Panel control.

            'Declare checkbox
            Dim chk As HtmlInputCheckBox

            'Loop
            Dim i As Integer
            For i = 0 To 3 Step i + 1
                'Instantiate and create checkbox
                chk = New HtmlInputCheckBox()
                chk.ID = "chk" + i

                'Create a panel and add the checkboxes to it
                pnlCheck.Controls.Add(chk)

            Next

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old November 6th, 2006, 04:05 AM
Authorized User
 
Join Date: Oct 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey mike thanx for the reply....
i worte the following code of urs ...
dim chk as htmlinputcheckbox
dim i as integer
for i=0 to 3 step i+1
chk= new htmlinputcheckbox()
chk.ID= "chk" + i ****error
pnlcheck.controls.add(chk)
next

bt the problem is that it is showing an error on above mentioned
line. the arror is....----
"input string was not in a correct format"
now tell me what to do?
i hope u will understand it
thnx in advance

abhishek

 
Old November 6th, 2006, 05:12 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Replace the error line with the line below, + is the operator to concat in C#, while in VB its &

chk.ID = "chk" & i




Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old November 6th, 2006, 06:09 AM
Authorized User
 
Join Date: Oct 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot mike....
u really helped me out of this ....
now im trying to create some no. of check boxes in my first
page n when the user clicks some of them,
that data should be transfered to other page...
can u help me...
thanks in advance

abhishek

 
Old November 6th, 2006, 06:35 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

Just loop through the controls of panel, cast it to a checkbox and find whether it is checked, if so pass the value to the next page as querystring.

As a general rule, please understand we are here to help you out, not do the work for you. If you face any difficulties, let us know and we shall help you out.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old November 23rd, 2006, 06:26 AM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello.

I am very new at the VB.Net language. I have impressed myself with finding this discussion as I had the same question. I am using VB2003 and I was wondering if someone could let me know how to determine the number of checkboxes created on the form. This would be after the subroutine has already created the checkboxes and ended. I would prefer not to pass the number of checkboxes throughout the program.

Happy Thanksgiving to the people that celebrate the holiday, and Happy Thursday to those that do not.

Thanks for helping!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating new buttons at runtime and making them v tknnguyen Visual Basic 2008 Essentials 1 June 6th, 2008 10:26 AM
Creating CheckBox at runtime. sachingowdar Java GUI 2 April 22nd, 2007 09:55 PM
Creating a DLL at runtime jai2k Beginning VB 6 1 January 5th, 2005 01:23 PM
Creating Access database at runtime in C# janigorse General .NET 0 September 18th, 2004 06:24 AM
Creating Access database at runtime janigorse Access 0 September 18th, 2004 03:48 AM





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