Home All Groups Group Topic Archive Search About
Author
7 Nov 2005 11:09 AM
chandra
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?

Author
7 Nov 2005 2:03 PM
S.M. Altaf [MVP]
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


Show quoteHide quote
"chandra" <chan***@discussions.microsoft.com> wrote in message
news:C841446C-F1DB-47B9-AC74-60727E0FC2C8@microsoft.com...
> 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?
>