Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 November 24th, 2005, 06:25 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default Checkbox server control

Hi,

If anybody having solution for the problem help with it immediately. I am creating a array (matrix) of checkboxes from database. I am having different values in database like, Hallnumber, HallRow, HallColumn and I am taking the Row and Column Values by checking the selected Hall number.

If the hall is existing, the code should create the array of the checkboxes. When I tried with, it created the checkboxes but what the problem is it is not taking the row-by-column values when I am retrieving them, instead it is returning only the textpart of the checkboxes.

Then I tried to assign the value to the checkbox and it is not taking the values too. As the problem occured I tried with checkboxlist but the problem is the checkboxlist is taking only onedimentional array.

Please help me if anybody knows how to assgin the values to checkboxes dynamically. I want to assign the i, j(row and column values) combinedly to that checkbox.

My code seems like this

<table cellspacing="0" cellpadding="0" width="100%">
                            <tbody>
                                <%for i=1 to session("sr")%>
                                <tr>
                                    <%for j=1 to session("sc")%>
                                    <td>
                                        <%="<asp:checkbox runat='server' id='chk"%><%=i%><%=J%><%="' text='seat"%><%=i%><%=j%><%="'></asp:checkbox>"%></td>
                                    <%next%>
                                </tr>
                                <%next%>
                            </tbody>
                        </table>

When I am trying like this it is not writing any values.

Thanks and Regards,

Senthil Kumar M.

[email protected]
http://www.leanlearn.tk
__________________
Thanks in advance.

Regards,

Senthil Kumar M.
 
Old November 26th, 2005, 01:54 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Create your checkbox controls dynamically

Dim cb as New checkbox
cb.id = "some val"
cb.<property> = "something"

Then add it to your page:
Me.FindControl("Form1").Controls.Add(cb)


 
Old November 26th, 2005, 05:47 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default

Thank you Benson. But this is to create a single checkbox dynamically and I know the method of creating a single dynamic checkbox and I tried too to create the array of checkboxes.

But here I want to create an array of checkboxes in a matrix format, for example, my hall is having 13 rows and 14 columns, I want to place the seats 13X14 (182 seats-checkboxes).

Thanks and Regards,

Senthil Kumar M.

[email protected]
http://www.leanlearn.tk
 
Old November 27th, 2005, 02:30 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

My code was just an example. You can create as many as you need in a loop. The code you are trying to get working is classic ASP code not .NET code.

Why don't you create a table (13X14) and add a check box to each cell?






Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox control and bit field keyvanjan ASP.NET 1.0 and 1.1 Basics 2 September 6th, 2006 05:09 PM
checkbox ( control ) mateenmohd Javascript 2 January 2nd, 2005 07:16 AM
binding an tinyint to a CheckBox control... ShadowMoon ADO.NET 0 October 26th, 2004 05:55 AM
checkbox in grid control rahilahmed Excel VBA 0 May 12th, 2004 02:48 PM





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