Groups | Blog | Home
all groups > asp.net webcontrols > november 2005 >

asp.net webcontrols : Hyperlink Control


S.M. Altaf [MVP]
11/7/2005 12:00:00 AM
Hi Chandra,

I'm not sure why the page is opening in a new window, but you can try to add
an attribute to your hyperlink object.

h02.Attributes.Add("target","_self");

(or try with _top to escape from any frames)

HTH
Altaf

--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com


[quoted text, click to view]

chandra
11/7/2005 3:09:00 AM
Hi,
I am a newcomer in the asp .NET c# area. I really need some help here.

I have two web page DEFAULT.ASPX and JOBCATEGORY.ASPX.
Inside the DEFAULT.ASPX there are some webparts.

There is a hyperlink control in one of the webparts that I generate using
the following codes,

HyperLink h02 = new HyperLink ();
h02.Controls.Add ( UpdateImage );
h02.Attributes.Add ("target", "_blank" );
h02.Attributes.Add ("cursor", "hand");
h02.NavigateUrl = URL1; where URL1 = "http://localhost/jobcategory.aspx"
cell.Controls.Add ( h02 );
row.Cells.Add ( cell );
webPartDataTable.Rows.Add ( row );

The result, when I click the above hyperlink control it redirect to a new
window jobcategory.aspx, that actually I don't want to have it. I prefer to
get the same window, closing the default.aspx and after that showing up the
job category.aspx in the same window.

Is there anyone who could help me to get what I want?
AddThis Social Bookmark Button