Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Url not working correctly in DataGrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tshad - 31 Jul 2007 04:21 GMT
I have a page that is loading a control from another folder.  I want the
references to be from current folder not the folder the control came from.
And that has been working fine in most cases.  But not for this one.

This is DataGrid with a Hyperlink column.  The page
www.ft.com/jobseeker/test.aspx is loading a control from
www.ft.com/applicant/login.ascx.

In www.ft.com/applicant/login.ascx I have the following column in my my
datagrid.

<asp:HyperLinkColumn DataTextField="JobTitleDesc" DataTextFormatString="{0}"
DataNavigateUrlField="PositionID"
DataNavigateUrlFormatString="displayPositionNS.aspx?PositionID={0}"
headertext="Job Title"
ItemStyle-Width="250px"
ItemStyle-VerticalAlign="Top"
sortexpression="p.JobTitle"/>

The problem is that the link is showing as
www.ft.com/applicant/displayPositionNS.aspx.PositionID=10 instead of
www.ft.com/jobseeker/displayPositionNS.aspx.PositionID=10 as it should.

I don't want to hard code this as this control is called from a couple of
different places and it should always use the .aspx page location not the
.ascx location.

Does anyone know why this is not working yet it works in other places?

Thanks,

Tom
Brandon Gano - 31 Jul 2007 04:35 GMT
Try ~/jobseeker/displayPositionNS.aspx. ASP.NET maps (~) to the root folder
of your site.

>I have a page that is loading a control from another folder.  I want the
> references to be from current folder not the folder the control came from.
[quoted text clipped - 29 lines]
>
> Tom
tshad - 31 Jul 2007 05:24 GMT
> Try ~/jobseeker/displayPositionNS.aspx. ASP.NET maps (~) to the root folder
> of your site.

No, that wouldn't get me what I am trying to do.

I want "displayPositionNS.aspx" to go to the displayPositionNS.aspx in the
current directory.  It could also be
www.staffingworkshop.com\employer\DisplayPositionNS.aspx that uses the .ascx
control.  In this case, I would want it to open the file in the employer
site.  I need it to look at where the original .aspx file is and use that
folder.

Thanks,

Tom

> >I have a page that is loading a control from another folder.  I want the
> > references to be from current folder not the folder the control came from.
[quoted text clipped - 29 lines]
> >
> > Tom
tshad - 31 Jul 2007 17:22 GMT
Also, on the same page I have:

 Response.Redirect("displayCompanyOverview.aspx?CID=" & CompanyID.Text)

This one doesn't go the the "Applicant" folder to get
displayCompanyOverview.aspx - it goes to the JobSeeker or Employer folders
to the file (depending on where the original .aspx page was).

Thanks,

Tom

>> Try ~/jobseeker/displayPositionNS.aspx. ASP.NET maps (~) to the root
> folder
[quoted text clipped - 50 lines]
>> >
>> > Tom
tshad - 01 Aug 2007 00:52 GMT
The problem would be even worse if I were to put the Controls in a
/Controls/ folder so that the path to all my controls were in:

/inetpub/wwwroot/stw/controls.

I obviously don't want my links to go to my controls folder to get my pages.
I want them relative to the folder my .aspx folder is.

For example, my page might be in:

/inetpub/wwwroot/stw/jobseeker/   or /inetpub/wwwroot/stw/employer/

and call my control in my /controls/ folder.  If I have a hyperlink to
another page, I would want it to get the .aspx page from either the
jobseeker or employer folders depending on where the page I am calling it
from is.

I found that the <asp:hyperlink> has the same problem.  The only way around
it seems to be to never use the hyperlink tag and conver all my tables and
links on my pages to do Response.Redirct which works correctly.

Thanks,

Tom

> Also, on the same page I have:
>
[quoted text clipped - 66 lines]
>>> >
>>> > Tom

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.