Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Url not working correctly in DataGrid (http://www.velocityreviews.com/forums/t525852-url-not-working-correctly-in-datagrid.html)

tshad 07-31-2007 03:21 AM

Url not working correctly in DataGrid
 
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



Brandon Gano 07-31-2007 03:35 AM

Re: Url not working correctly in DataGrid
 
Try ~/jobseeker/displayPositionNS.aspx. ASP.NET maps (~) to the root folder
of your site.


"tshad" <t@home.com> wrote in message
news:OR6$zHy0HHA.5764@TK2MSFTNGP03.phx.gbl...
>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
>
>



tshad 07-31-2007 04:24 AM

Re: Url not working correctly in DataGrid
 

"Brandon Gano" <bgano@inocompany.com> wrote in message
news:65C7A8CD-BE53-4D2C-B6C6-CA76391A2F92@microsoft.com...
> 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" <t@home.com> wrote in message
> news:OR6$zHy0HHA.5764@TK2MSFTNGP03.phx.gbl...
> >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
> >
> >

>




tshad 07-31-2007 04:22 PM

Re: Url not working correctly in DataGrid
 
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" <t@home.com> wrote in message
news:eZOdJry0HHA.4184@TK2MSFTNGP06.phx.gbl...
>
> "Brandon Gano" <bgano@inocompany.com> wrote in message
> news:65C7A8CD-BE53-4D2C-B6C6-CA76391A2F92@microsoft.com...
>> 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" <t@home.com> wrote in message
>> news:OR6$zHy0HHA.5764@TK2MSFTNGP03.phx.gbl...
>> >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
>> >
>> >

>>

>
>




tshad 07-31-2007 11:52 PM

Re: Url not working correctly in DataGrid
 
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" <t@home.com> wrote in message
news:uZeN4740HHA.464@TK2MSFTNGP02.phx.gbl...
> 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" <t@home.com> wrote in message
> news:eZOdJry0HHA.4184@TK2MSFTNGP06.phx.gbl...
>>
>> "Brandon Gano" <bgano@inocompany.com> wrote in message
>> news:65C7A8CD-BE53-4D2C-B6C6-CA76391A2F92@microsoft.com...
>>> 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" <t@home.com> wrote in message
>>> news:OR6$zHy0HHA.5764@TK2MSFTNGP03.phx.gbl...
>>> >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
>>> >
>>> >
>>>

>>
>>

>
>





All times are GMT. The time now is 10:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.