Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 13th, 2007, 03:52 AM
Authorized User
 
Join Date: Feb 2007
Location: Kolkata, West Bengal, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default navigation bar problem

Hi friends,

I have faced a problem in programming ASP.Net, and I need your help.
I am using VS.Net 2003, and .Net 1.1.

Now the problem is, I need to generate a navigation bar (hyperlinks), for my application, but I have not found any method for generating and rendering it dynamically, except using
Response.Write(“<a href=… >”)

Is there any other method, better than this one?

Secondly even if I display the navigation bar in that method, I can not control the position of displaying that in a proper way. To do this I used a lot of <br /> in statement. Like
Response.Write(“<br /><br /> … <br />”)
Response.Write(“<a href=… >”)

It is not a method of preference, especially when you want to form the layout of the whole page using table. And with this method the position may vary with the change of resolution or browser, I suppose.
So is there any method to display the dynamically created hyperlinks in an empty cell of a table?
And I don’t know whether ‘Response.Write’ statements can be put into ‘placeholders’. But in ‘placeholder’ hyperlinks becomes plane text, I have seen.

If not, could you suggest some better way to do this?
How this is done in professional web pages?

Any suggestion will be of great help.
Thanks.


Aritra Mukherjee,
CS-4th Year,
MSIT-Kolkata.
__________________
Aritra Mukherjee,
CS-4th Year,
MSIT-Kolkata.
  #2 (permalink)  
Old March 13th, 2007, 07:08 AM
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

You could create a user control that uses the System.Web.UI.HtmlTextWriter to achieve this. I am not saying this is any better then Response.Write as you will still use alot of lines, for example to write out a <td> tag you would do something like:

hwriter.WriteBeginTag("td")
                        hwriter.WriteAttribute("width", "125")
                        hwriter.WriteAttribute("style", "background-color: #DDDDDD;font-family:Verdana, Times New Roman, Tahoma;font-size:12px;color: #000066;")
                        hwriter.WriteAttribute("valign", "top")
                        hwriter.Write(HtmlTextWriter.TagRightChar)

this will produce this when it is rendered:
<td width=125 style="background-color: #DDDDDD;font-family:Verdana, Times New Roman, Tahoma;font-size:12px;color: #000066;" valign=top>

So, essentially, you would build your entire layout inside of that Writer and then you would make this call:
MyBase.Render(hwriter) inside of the page render event.

hth.

================================================== =========
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
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #3 (permalink)  
Old March 13th, 2007, 12:08 PM
Authorized User
 
Join Date: Feb 2007
Location: Kolkata, West Bengal, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for the help.
but how could i mention,where to render that control ??
how will this work if i want to render that control, at run time, in a cell of a pre-craeted table?
can this be done ?

Aritra Mukherjee,
CS-4th Year,
MSIT-Kolkata.
  #4 (permalink)  
Old March 13th, 2007, 12:23 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

Override the page render event in the usercontrol.

================================================== =========
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
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #5 (permalink)  
Old March 13th, 2007, 12:27 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

Something like this:

    Protected Overrides Sub Render(ByVal hwriter As System.Web.UI.HtmlTextWriter)
        MyBase.Render(hwriter)
    End Sub

================================================== =========
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
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #6 (permalink)  
Old March 13th, 2007, 12:32 PM
Authorized User
 
Join Date: Feb 2007
Location: Kolkata, West Bengal, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot, Mr. dparsons.

Aritra Mukherjee,
CS-4th Year,
MSIT-Kolkata.
 


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
page with navigation bar problem zouky ASP.NET 1.0 and 1.1 Basics 0 October 21st, 2004 03:03 AM
navigation bar in templates amc Dreamweaver (all versions) 1 July 9th, 2004 03:48 AM
Navigation Bar help Varg_88 Classic ASP Databases 1 May 12th, 2004 07:33 AM
recordset navigation bar... joeore PHP Databases 2 March 4th, 2004 05:49 PM



All times are GMT -4. The time now is 02:28 PM.


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