Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Url not working correctly in DataGrid

Reply
Thread Tools

Url not working correctly in DataGrid

 
 
tshad
Guest
Posts: n/a
 
      07-31-2007
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.asp x?PositionID={0}"
headertext="Job Title"
ItemStyle-Width="250px"
ItemStyle-VerticalAlign="Top"
sortexpression="p.JobTitle"/>

The problem is that the link is showing as
http://www.ft.com/applicant/displayP....PositionID=10 instead of
http://www.ft.com/jobseeker/displayP....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


 
Reply With Quote
 
 
 
 
Brandon Gano
Guest
Posts: n/a
 
      07-31-2007
Try ~/jobseeker/displayPositionNS.aspx. ASP.NET maps (~) to the root folder
of your site.


"tshad" <(E-Mail Removed)> wrote in message
news:OR6$(E-Mail Removed)...
>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.asp x?PositionID={0}"
> headertext="Job Title"
> ItemStyle-Width="250px"
> ItemStyle-VerticalAlign="Top"
> sortexpression="p.JobTitle"/>
>
> The problem is that the link is showing as
> http://www.ft.com/applicant/displayP....PositionID=10 instead of
> http://www.ft.com/jobseeker/displayP....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
>
>


 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      07-31-2007

"Brandon Gano" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
http://www.staffingworkshop.com\empl...ositionNS.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

>
>
> "tshad" <(E-Mail Removed)> wrote in message
> news:OR6$(E-Mail Removed)...
> >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.asp x?PositionID={0}"
> > headertext="Job Title"
> > ItemStyle-Width="250px"
> > ItemStyle-VerticalAlign="Top"
> > sortexpression="p.JobTitle"/>
> >
> > The problem is that the link is showing as
> > http://www.ft.com/applicant/displayP....PositionID=10 instead of
> > http://www.ft.com/jobseeker/displayP....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
> >
> >

>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      07-31-2007
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

"tshad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Brandon Gano" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
> http://www.staffingworkshop.com\empl...ositionNS.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
>
>>
>>
>> "tshad" <(E-Mail Removed)> wrote in message
>> news:OR6$(E-Mail Removed)...
>> >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.asp x?PositionID={0}"
>> > headertext="Job Title"
>> > ItemStyle-Width="250px"
>> > ItemStyle-VerticalAlign="Top"
>> > sortexpression="p.JobTitle"/>
>> >
>> > The problem is that the link is showing as
>> > http://www.ft.com/applicant/displayP....PositionID=10 instead of
>> > http://www.ft.com/jobseeker/displayP....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
>> >
>> >

>>

>
>



 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      07-31-2007
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

"tshad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> "tshad" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>
>> "Brandon Gano" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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
>> http://www.staffingworkshop.com\empl...ositionNS.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
>>
>>>
>>>
>>> "tshad" <(E-Mail Removed)> wrote in message
>>> news:OR6$(E-Mail Removed)...
>>> >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.asp x?PositionID={0}"
>>> > headertext="Job Title"
>>> > ItemStyle-Width="250px"
>>> > ItemStyle-VerticalAlign="Top"
>>> > sortexpression="p.JobTitle"/>
>>> >
>>> > The problem is that the link is showing as
>>> > http://www.ft.com/applicant/displayP....PositionID=10 instead of
>>> > http://www.ft.com/jobseeker/displayP....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
>>> >
>>> >
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid Viewstate not working correctly? Nomen Nescio ASP .Net 2 02-07-2007 11:15 AM
Re: dropdownlist box not working correctly Hermit Dave ASP .Net 0 09-02-2004 04:10 PM
sort not working correctly =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?= ASP .Net 4 08-18-2004 01:43 PM
History not working correctly Stuart Palmer HTML 0 06-02-2004 09:50 AM
Cisco 1721 and routing not working correctly Brian Cisco 4 10-24-2003 10:37 PM



Advertisments