Url not working correctly in DataGrid

Discussion in 'ASP .Net' started by tshad, Jul 31, 2007.

  1. tshad

    tshad Guest

    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
     
    tshad, Jul 31, 2007
    #1
    1. Advertising

  2. tshad

    Brandon Gano Guest

    Try ~/jobseeker/displayPositionNS.aspx. ASP.NET maps (~) to the root folder
    of your site.


    "tshad" <> wrote in message
    news:OR6$...
    >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, Jul 31, 2007
    #2
    1. Advertising

  3. tshad

    tshad Guest

    "Brandon Gano" <> wrote in message
    news:...
    > 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

    >
    >
    > "tshad" <> wrote in message
    > news:OR6$...
    > >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
    > >
    > >

    >
     
    tshad, Jul 31, 2007
    #3
  4. tshad

    tshad Guest

    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" <> wrote in message
    news:...
    >
    > "Brandon Gano" <> wrote in message
    > news:...
    >> 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
    >
    >>
    >>
    >> "tshad" <> wrote in message
    >> news:OR6$...
    >> >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
    >> >
    >> >

    >>

    >
    >
     
    tshad, Jul 31, 2007
    #4
  5. tshad

    tshad Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >>
    >> "Brandon Gano" <> wrote in message
    >> news:...
    >>> 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
    >>
    >>>
    >>>
    >>> "tshad" <> wrote in message
    >>> news:OR6$...
    >>> >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
    >>> >
    >>> >
    >>>

    >>
    >>

    >
    >
     
    tshad, Aug 1, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=

    sort not working correctly

    =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=, Aug 18, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    521
    =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=
    Aug 18, 2004
  2. Hermit Dave

    Re: dropdownlist box not working correctly

    Hermit Dave, Sep 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    420
    Hermit Dave
    Sep 2, 2004
  3. Stuart Palmer

    History not working correctly

    Stuart Palmer, Jun 2, 2004, in forum: HTML
    Replies:
    0
    Views:
    386
    Stuart Palmer
    Jun 2, 2004
  4. rosemm
    Replies:
    2
    Views:
    805
    Martin Honnen
    Apr 5, 2005
  5. Nomen Nescio

    Datagrid Viewstate not working correctly?

    Nomen Nescio, Feb 7, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    378
    Non scrivetemi
    Feb 7, 2007
Loading...

Share This Page