Wrox Programmer Forums
|
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 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 March 13th, 2007, 03:52 AM
Authorized User
 
Join Date: Feb 2007
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.
 
Old March 13th, 2007, 07:08 AM
Wrox Author
 
Join Date: Oct 2005
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
================================================== =========
 
Old March 13th, 2007, 12:08 PM
Authorized User
 
Join Date: Feb 2007
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.
 
Old March 13th, 2007, 12:23 PM
Wrox Author
 
Join Date: Oct 2005
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
================================================== =========
 
Old March 13th, 2007, 12:27 PM
Wrox Author
 
Join Date: Oct 2005
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
================================================== =========
 
Old March 13th, 2007, 12:32 PM
Authorized User
 
Join Date: Feb 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks alot, Mr. dparsons.

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





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





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