Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 3rd, 2005, 09:51 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unique Control IDs inside a loop using a varible

I'm trying to loop through a recordset and display the entires. No Problem.

Each entry has boolean, which corresponds to a checkbox. No Problem

Now after a user changes the checkboxes and a final update function is called I need to see which chekboxes have been changed and update the SQL data accordingly. Sounds easy enough.

So I should give each checkbox a unique name, since I'm inside a loop this SHOULD be a no-brainer. however I can't seem to use variables in the ID paramater of an ASP:Checkbox???

Reply With Quote
  #2 (permalink)  
Old February 3rd, 2005, 10:07 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

For each record you would be having a unique id in the table right? Add that as an ID to checkbox which creating. When user submits now you get the ID's of those checkbox which were clicked and update the DB accordingly.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
Reply With Quote
  #3 (permalink)  
Old February 3rd, 2005, 10:44 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes each record has an ID in the table, and it's passed to the page.

However when I try to reference the entry ID to use as a control ID:

<asp:checkbox runat="server" ID=<%=SurveyRow["ID"] %> />

The error "Server tags cannot contain <% ... %> constructs" is returned. So What if I tried to set a varible "e" then use it:

<%
    foreach(DataRow SurveyRow in Table)
        {
        string e = SurveyRow["ID"];
%>
 <asp:checkbox runat="server" ID=<%=SurveyRow["PkSurveyID"] %> />
<%
        }
%>

Is there a way to reference "e" or???

Thanks Josh!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Generate Unique values for IDs mphare XSLT 7 November 6th, 2008 12:20 PM
Control IDs in content pages LMIILM BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 1 December 8th, 2007 06:30 AM
Ints or Unique IDs? pettrer ASP.NET 2.0 Basics 3 June 5th, 2006 08:28 PM
Pass variables from array inside a loop dustygn PHP How-To 2 May 3rd, 2006 05:35 PM
unique login names and incremental user IDs krstofer Classic ASP Basics 8 March 11th, 2004 10:55 AM



All times are GMT -4. The time now is 12:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.