Print Page | Close Window

Determine a CheckBox Name?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=9515
Printed Date: 29 March 2026 at 6:46pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Determine a CheckBox Name?
Posted By: aalavar
Subject: Determine a CheckBox Name?
Date Posted: 03 February 2004 at 4:52pm

I have a page that contains many individual checkboxes, each checkbox is associated with a seat and has a distinct name based on row and seat number (ie checkbox id = "t14" for seat 14 in row t).  I need to be able to set a checkbox's visible flag = False if the seat is already taken, and I am having some difficulty with it.  The seats are not aligned since seating is not necissarily straight, it can be a circle or arc, so I do not want to create a subroutine to generate the checkboxes on the fly, I would rather generate all the checkboxes, then run a subroutine that would set the corresponding flags to non-visible if they are taken.

I can find all of the checkbox controls on a form, but I cannot compare them to a specific name, so I cannot change their values.  Let's say I have a list of 3 seats taken {r12,r13,r14}... how can I create a subroutine that will set the checkbox flag for r12,r13,r14 = false?

Any help or points in the right direction would be helpful.  Thanks!




Replies:
Posted By: Leeb65
Date Posted: 04 February 2004 at 2:34am

Can you show us some code you have already written?



Posted By: aalavar
Date Posted: 04 February 2004 at 8:31am

I have a sql statement that returns to me a list of all of the seats already taken.  I combine the seat row and seat number to create a seatid, which is the same name as the checkbox i.e.

Sub get_Rows
...
  'Open db get recordset
  Row = RS("sRow")
  Num = RS("sNum")
  ID = Row + Num 'ID = 'Q14' for example
  'Get next record
...
End Sub


I have a series of checkboxes in the body of the page:
<body>
....
' Row Q
<asp:CheckBox id="Q12" style="Z-INDEX: 101; LEFT: 120px; POSITION: absolute; TOP: 420px"
runat="server" Text=" " BorderColor="Transparent" BackColor="Transparent" ForeColor="Transparent"></asp:CheckBox>
<asp:CheckBox id="Q13" style="Z-INDEX: 118; LEFT: 676px; POSITION: absolute; TOP: 346px"
runat="server" Text=" " BorderColor="Transparent" BackColor="Transparent" ForeColor="Transparent"></asp:CheckBox>
<asp:CheckBox id="Q14" style="Z-INDEX: 117; LEFT: 659px; POSITION: absolute; TOP: 341px"
runat="server" Text=" " BorderColor="Transparent" BackColor="Transparent" ForeColor="Transparent"></asp:CheckBox>
<asp:CheckBox id="Q15" style="Z-INDEX: 115; LEFT: 643px; POSITION: absolute; TOP: 336px"
runat="server" Text=" " BorderColor="Transparent" BackColor="Transparent" ForeColor="Transparent"></asp:CheckBox>
<asp:CheckBox id="Q16" style="Z-INDEX: 114; LEFT: 626px; POSITION: absolute; TOP: 331px"
runat="server" Text=" " BorderColor="Transparent" BackColor="Transparent" ForeColor="Transparent"></asp:CheckBox>
....

As you can see they are not in any geometric pattern, they are matched to a specific layout of a room and how seats are aligned.  What I need to be able to do in the sub is once I have 'Q14' set the visible flag = false for the checkbox with id='Q14'.

Any ideas?

 



Posted By: aalavar
Date Posted: 04 February 2004 at 9:48am

Nevermind, I figured it out. =)

Dim ct2 as new Checkbox()
ct2 = ctl ' where ctl = a checkbox
if ct2.id="Q14" Then
  ct2.visible = False
End if

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net