473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding a Hyperlink control to a PlaceHolder

Hi,

I have an <asp:PlaceHolder control on a page in an ASP.NET 1.1 app, as
follows:

<td nowrap><asp:PlaceHolder ID="phClientWebsite"
Runat=server>&nbsp;</asp:PlaceHolder></td>

Server-side, I'm running the following code:

HyperLink lnkWebsite = new HyperLink();
lnkWebsite.NavigateUrl = dr["strWebsite"].ToString();
lnkWebsite.Target = "_blank";
Page.FindControl("phClientWebsite").Controls.Add(l nkWebsite);
However, the hyperlink is not displayed on the page, although it appears in
the HTML when I do a View Source. Incidentally, if I copy the HTML from View
Source into a stand-alone HTML page, the hyperlink is displayed.

Incidentally, I've also tried this with an <asp:Label control, to no
avail...

What am I doing wrong?

Any assistance gratefully received.

Mark Rae
Nov 18 '05 #1
4 3119
Hey Mark,

If link is showing in the source code but not being rendered properly by the
browser, I'd question whether the HTML is well formed.

Ken

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

I have an <asp:PlaceHolder control on a page in an ASP.NET 1.1 app, as
follows:

<td nowrap><asp:PlaceHolder ID="phClientWebsite"
Runat=server>&nbsp;</asp:PlaceHolder></td>

Server-side, I'm running the following code:

HyperLink lnkWebsite = new HyperLink();
lnkWebsite.NavigateUrl = dr["strWebsite"].ToString();
lnkWebsite.Target = "_blank";
Page.FindControl("phClientWebsite").Controls.Add(l nkWebsite);
However, the hyperlink is not displayed on the page, although it appears
in the HTML when I do a View Source. Incidentally, if I copy the HTML from
View Source into a stand-alone HTML page, the hyperlink is displayed.

Incidentally, I've also tried this with an <asp:Label control, to no
avail...

What am I doing wrong?

Any assistance gratefully received.

Mark Rae


Nov 18 '05 #2
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:Ox**************@TK2MSFTNGP12.phx.gbl...
If link is showing in the source code but not being rendered properly by
the browser, I'd question whether the HTML is well formed.

Incidentally, if I copy the HTML from View Source into a stand-alone HTML
page, the hyperlink is displayed.


Surely this means that it's well formed...?
Nov 18 '05 #3
Jos
Mark Rae wrote:
Hi,

I have an <asp:PlaceHolder control on a page in an ASP.NET 1.1 app, as
follows:

<td nowrap><asp:PlaceHolder ID="phClientWebsite"
Runat=server>&nbsp;</asp:PlaceHolder></td>

Server-side, I'm running the following code:

HyperLink lnkWebsite = new HyperLink();
lnkWebsite.NavigateUrl = dr["strWebsite"].ToString();
lnkWebsite.Target = "_blank";
Page.FindControl("phClientWebsite").Controls.Add(l nkWebsite);
However, the hyperlink is not displayed on the page, although it
appears in the HTML when I do a View Source.
I noticed that you don't set the "Text" property of your Hyperlink control.
This will cause it to be invisible in the page.
Incidentally, if I copy
the HTML from View Source into a stand-alone HTML page, the hyperlink
is displayed.


This is weird.

--

Jos
Nov 18 '05 #4
"Jos" <jn*************@fastmail.fm> wrote in message
news:uN**************@TK2MSFTNGP14.phx.gbl...
Incidentally, if I copy
the HTML from View Source into a stand-alone HTML page, the hyperlink
is displayed.


This is weird.


I did an iisreset and now everything's working again...????
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cfullerton | last post by:
I have 2 pages, with similar code. The first page has a DataGrid, with a HyperLink col: <asp:HyperLinkColumn HeaderText="Name" SortExpression="person_last_name"></asp:HyperLinkColumn> In...
3
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" ...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
3
by: sloesch | last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net, and ASP.net, and I would like to know how you can create a dynamic hyperlink on the fly to a document stored in a SQL database?...
3
by: Mark Denardo | last post by:
I'm trying to dynamically create and add controls to a web page: Label obj1 = new Label(); DropDownList obj2 = new DropDownList(); Controls.Add(obj1); Controls.Add(obj2); But I get the...
2
by: _MC_ | last post by:
Hi, i want to structure two elements (each conists of 1 Label and 1 Textbox) in an Table. As I use an Content Place Holder, i thought it is possible to add the table via Controls.add(Literal)....
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
6
by: alun65 | last post by:
I'm having trouble programmatically adding a user control and then setting some of it's server controls. I add the user control to the code behind and add it to a placeholder: protected void...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.