Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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 October 6th, 2007, 12:05 PM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using ID in hyperlink field

If I have a repeater with a asp:hyperlink field which i wont need to access programatically at all and is just used for databinding, is it ok if i dont use a id??

<tr>
 <td>
  <asp:HyperLink NavigateUrl='<% #Eval("topicid", "Threads.aspx?topic={0}")%>' Text='<% #Eval("name")%>' runat="server" /> <asp:Literal Text='<% #Eval("description")%>' runat="server" />
 </td>
</tr>

Like This with no ID:
<tr>
 <td>
  <a href="Threads.aspx?topic=1">Decorating</a> Get in the spirit by sharing your best decorating tips.
 </td>
</tr>

as aposed to This with a ID:
<tr>
 <td>
  <a id="ctl00_ContentPlaceHolder1_ForumRepeater_ctl00_ TopicRepeater_ctl00_lnk" href="Threads.aspx?topic=1">Decorating</a> Get in the spirit by sharing your best decorating tips.
 </td>
</tr>



Reply With Quote
  #2 (permalink)  
Old October 6th, 2007, 12:46 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Have you tried this prior to asking?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Beginning Visual C# 2008
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
Reply With Quote
  #3 (permalink)  
Old October 6th, 2007, 10:07 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

:)Yeah, the worst thing that happens is it breaks and you have an error message that you can ask us about!

It's also just a better way to learn. You have permission to screw up. You're programming. That's what we do all day long. Break things and try to figure out how to fix it.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply With Quote
  #4 (permalink)  
Old October 7th, 2007, 12:30 PM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah it works fine. I just wondered if that was considered the wrong way to go about things or bad practice.. its just when you view source it looks really messy with the id's.

Reply With Quote
  #5 (permalink)  
Old October 7th, 2007, 01:12 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

By using the actual <a href> tag it simply means that .NET has no way to access the control pragmatically and it is perfectly acceptable to do this. I would only consider this a bad practice if, for example, you had the href call a javascript that raised a postback when a simple link button could of sufficed.

But, for your example, it is all good =]

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Beginning Visual C# 2008
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
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
Accessing text in a hyperlink field mvyjim ASP.NET 2.0 Professional 0 March 10th, 2007 05:22 PM
Using Hyperlink field in GridView asp_convert ASP.NET 2.0 Basics 2 February 7th, 2007 07:33 PM
how to get autogenerate value for the ID Field MunishBhatia SQL Server 2000 5 December 8th, 2006 03:14 AM
How to retrieve ID field of newly-created record Steve777 Classic ASP Professional 3 October 2nd, 2006 11:27 AM
How to display one field as a hyperlink? emccraw Classic ASP Databases 4 September 5th, 2006 04:03 PM



All times are GMT -4. The time now is 01:22 PM.


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