Hyperlink in Datagrid works differently in a usercontrol?

C

cfullerton

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 the code-behind, I set the link to popup a page when clicked:

Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
....
Dim h1 As HyperLink = e.Item.Cells(1).Controls(0)
h1.NavigateUrl = "#"
h1.Attributes.Add("onClick", "return window.open('page.aspx?pid=" & pid
& _
"','editUser','height=500,width=800,left=50,top=10,resizable=yes,scrollbars=yes',true);")


The HTML generated has HREF="#". All is good. Clicking on the "link"
pops up a window, and the main page doesn't change.

When I have the identical code in a user control (that is loaded into a
PlaceHolder on another page), I end up with HREF="../DIR/#". (DIR is
the project dir that contains the user control). Clicking on the link
pops up the page, but the main page changes!

Any idea why the HREF would be different in the 2nd case?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,016
Latest member
TatianaCha

Latest Threads

Top