back to calling page

Discussion in 'ASP .Net Web Controls' started by Julia, Jun 11, 2006.

  1. Julia

    Julia Guest

    Hi
    I am developing a composite control, so I am writing all labels, button etc
    in code. In my composite control I have a button and when it is clicked I
    would like to go back to the calling page. This should be like using the back
    button in the internet explorer. How can I do this.

    Thanks
    Julia
    Julia, Jun 11, 2006
    #1
    1. Advertising

  2. Julia

    mnichols Guest

    Client-side javascript:
    <input type=button value="Go Back" onclick="history.go(-1)">

    Julia wrote:
    > Hi
    > I am developing a composite control, so I am writing all labels, button etc
    > in code. In my composite control I have a button and when it is clicked I
    > would like to go back to the calling page. This should be like using the back
    > button in the internet explorer. How can I do this.
    >
    > Thanks
    > Julia
    mnichols, Jun 11, 2006
    #2
    1. Advertising

  3. Julia

    Julia Guest

    Hi
    thanks for the answer but I am not sure I understand how to do this. I am
    writing all my component in the *.cs file, and I thought I was suppose to
    write som code in the Click event to handle this.

    I have a search page where the user can serch for products. When the user
    clicks a product a detail page opens. The detail page contains my Composite
    Control, and the Composite Control contains a button with the text "Back to
    Search". When this button is pressed the Serach page should be opened again.
    So this is the event that should open the Search page:

    void btnBackToSearch_Click(object sender, EventArgs e)
    {
    //What can I write here to open the search page?
    }

    Thanks
    Julia
    "mnichols" wrote:

    > Client-side javascript:
    > <input type=button value="Go Back" onclick="history.go(-1)">
    >
    > Julia wrote:
    > > Hi
    > > I am developing a composite control, so I am writing all labels, button etc
    > > in code. In my composite control I have a button and when it is clicked I
    > > would like to go back to the calling page. This should be like using the back
    > > button in the internet explorer. How can I do this.
    > >
    > > Thanks
    > > Julia

    >
    Julia, Jun 11, 2006
    #3
  4. If you somehow store the name of the calling page (maybe in session state or
    by posting it?) then you can simply Response.Redirect back to the page.

    Or, a simple approach like this *might* just do the trick:
    Response.Write("<script language='JavaScript'>history.go(-1)</script>");

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net



    "Julia" <> wrote in message
    news:...
    > Hi
    > I am developing a composite control, so I am writing all labels, button
    > etc
    > in code. In my composite control I have a button and when it is clicked I
    > would like to go back to the calling page. This should be like using the
    > back
    > button in the internet explorer. How can I do this.
    >
    > Thanks
    > Julia
    Steve C. Orr [MVP, MCSD], Jun 12, 2006
    #4
  5. Julia

    Julia Guest

    Hi Steve,
    and thanks for the answer. I have the name of the calling page, but as I
    answered to mnichols I dont understand how to use it. The problem is that I
    am writing all controls in code, I only use the *.cs file, so I would like to
    do the call to the previous page in the click event of my button. This is the
    event:

    void btnBackToSearch_Click(object sender, EventArgs e)
    {
    //What can I write here to open the search page?
    }

    Do you know what to write in the event to go back to the calling page?

    Thanks,
    Julia

    "Steve C. Orr [MVP, MCSD]" wrote:

    > If you somehow store the name of the calling page (maybe in session state or
    > by posting it?) then you can simply Response.Redirect back to the page.
    >
    > Or, a simple approach like this *might* just do the trick:
    > Response.Write("<script language='JavaScript'>history.go(-1)</script>");
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    >
    > "Julia" <> wrote in message
    > news:...
    > > Hi
    > > I am developing a composite control, so I am writing all labels, button
    > > etc
    > > in code. In my composite control I have a button and when it is clicked I
    > > would like to go back to the calling page. This should be like using the
    > > back
    > > button in the internet explorer. How can I do this.
    > >
    > > Thanks
    > > Julia

    >
    >
    >
    Julia, Jun 12, 2006
    #5
  6. Julia

    Prakash V Guest

    use btnBackToSearch.Attributes.Add("onclick","history.back()");

    Regards,
    Prakash.V
    "Julia" <> wrote in message
    news:...
    > Hi
    > thanks for the answer but I am not sure I understand how to do this. I am
    > writing all my component in the *.cs file, and I thought I was suppose to
    > write som code in the Click event to handle this.
    >
    > I have a search page where the user can serch for products. When the user
    > clicks a product a detail page opens. The detail page contains my
    > Composite
    > Control, and the Composite Control contains a button with the text "Back
    > to
    > Search". When this button is pressed the Serach page should be opened
    > again.
    > So this is the event that should open the Search page:
    >
    > void btnBackToSearch_Click(object sender, EventArgs e)
    > {
    > //What can I write here to open the search page?
    > }
    >
    > Thanks
    > Julia
    > "mnichols" wrote:
    >
    >> Client-side javascript:
    >> <input type=button value="Go Back" onclick="history.go(-1)">
    >>
    >> Julia wrote:
    >> > Hi
    >> > I am developing a composite control, so I am writing all labels, button
    >> > etc
    >> > in code. In my composite control I have a button and when it is clicked
    >> > I
    >> > would like to go back to the calling page. This should be like using
    >> > the back
    >> > button in the internet explorer. How can I do this.
    >> >
    >> > Thanks
    >> > Julia

    >>
    Prakash V, Jun 12, 2006
    #6
  7. hi Julia,
    Response.Redirect("thePageWhereIwantToGo.aspx"); is probaby what you are
    looking for.
    If you are not working in your codebehind for the webform(that inherits
    page) but simply in a class file(this can be true if you are working with
    custom controls for eg.) then you can use the HttpContext to get to the
    Response object and call Response.Redirect like this :
    HttpContext.Current.Response.Redirect("thePageWhereIwantToGo.aspx");
    More here :
    http://msdn2.microsoft.com/en-us/system.web.httpcontext.response.aspx

    Alessandro Zifiglio

    "Julia" <> ha scritto nel messaggio
    news:...
    > Hi Steve,
    > and thanks for the answer. I have the name of the calling page, but as I
    > answered to mnichols I dont understand how to use it. The problem is that
    > I
    > am writing all controls in code, I only use the *.cs file, so I would like
    > to
    > do the call to the previous page in the click event of my button. This is
    > the
    > event:
    >
    > void btnBackToSearch_Click(object sender, EventArgs e)
    > {
    > //What can I write here to open the search page?
    > }
    >
    > Do you know what to write in the event to go back to the calling page?
    >
    > Thanks,
    > Julia
    >
    > "Steve C. Orr [MVP, MCSD]" wrote:
    >
    >> If you somehow store the name of the calling page (maybe in session state
    >> or
    >> by posting it?) then you can simply Response.Redirect back to the page.
    >>
    >> Or, a simple approach like this *might* just do the trick:
    >> Response.Write("<script language='JavaScript'>history.go(-1)</script>");
    >>
    >> --
    >> I hope this helps,
    >> Steve C. Orr, MCSD, MVP
    >> http://SteveOrr.net
    >>
    >>
    >>
    >> "Julia" <> wrote in message
    >> news:...
    >> > Hi
    >> > I am developing a composite control, so I am writing all labels, button
    >> > etc
    >> > in code. In my composite control I have a button and when it is clicked
    >> > I
    >> > would like to go back to the calling page. This should be like using
    >> > the
    >> > back
    >> > button in the internet explorer. How can I do this.
    >> >
    >> > Thanks
    >> > Julia

    >>
    >>
    >>
    Alessandro Zifiglio, Jun 13, 2006
    #7
  8. Julia, by the way, since you never mentioned what control or class you are
    inheriting if any, if for eg. you were inheriting Control, WebControl,
    CompositeControl etc..then the HttpContext is already exposed as a
    property(Context), so simply calling the Context property which exposes
    "HttpContext" object will be just fine. So you will be doing
    this.Context.Current.Response.Redirect(.....).. and so on :)

    Regards,
    Alessandro Zifiglio
    "Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> ha scritto
    nel messaggio news:...
    > hi Julia,
    > Response.Redirect("thePageWhereIwantToGo.aspx"); is probaby what you are
    > looking for.
    > If you are not working in your codebehind for the webform(that inherits
    > page) but simply in a class file(this can be true if you are working with
    > custom controls for eg.) then you can use the HttpContext to get to the
    > Response object and call Response.Redirect like this :
    > HttpContext.Current.Response.Redirect("thePageWhereIwantToGo.aspx");
    > More here :
    > http://msdn2.microsoft.com/en-us/system.web.httpcontext.response.aspx
    >
    > Alessandro Zifiglio
    >
    > "Julia" <> ha scritto nel messaggio
    > news:...
    >> Hi Steve,
    >> and thanks for the answer. I have the name of the calling page, but as I
    >> answered to mnichols I dont understand how to use it. The problem is that
    >> I
    >> am writing all controls in code, I only use the *.cs file, so I would
    >> like to
    >> do the call to the previous page in the click event of my button. This is
    >> the
    >> event:
    >>
    >> void btnBackToSearch_Click(object sender, EventArgs e)
    >> {
    >> //What can I write here to open the search page?
    >> }
    >>
    >> Do you know what to write in the event to go back to the calling page?
    >>
    >> Thanks,
    >> Julia
    >>
    >> "Steve C. Orr [MVP, MCSD]" wrote:
    >>
    >>> If you somehow store the name of the calling page (maybe in session
    >>> state or
    >>> by posting it?) then you can simply Response.Redirect back to the page.
    >>>
    >>> Or, a simple approach like this *might* just do the trick:
    >>> Response.Write("<script language='JavaScript'>history.go(-1)</script>");
    >>>
    >>> --
    >>> I hope this helps,
    >>> Steve C. Orr, MCSD, MVP
    >>> http://SteveOrr.net
    >>>
    >>>
    >>>
    >>> "Julia" <> wrote in message
    >>> news:...
    >>> > Hi
    >>> > I am developing a composite control, so I am writing all labels,
    >>> > button
    >>> > etc
    >>> > in code. In my composite control I have a button and when it is
    >>> > clicked I
    >>> > would like to go back to the calling page. This should be like using
    >>> > the
    >>> > back
    >>> > button in the internet explorer. How can I do this.
    >>> >
    >>> > Thanks
    >>> > Julia
    >>>
    >>>
    >>>

    >
    >
    Alessandro Zifiglio, Jun 13, 2006
    #8
    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. anouk
    Replies:
    1
    Views:
    412
    Boban Dragojlovic
    Jul 24, 2003
  2. BillGatesFan

    Going back to calling page

    BillGatesFan, Jan 3, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    2,983
    jongalloway
    Jan 4, 2005
  3. Samy
    Replies:
    0
    Views:
    523
  4. jobs
    Replies:
    0
    Views:
    305
  5. Jason

    Back to calling page and refreshed

    Jason, Oct 26, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    128
    Jason
    Oct 26, 2006
Loading...

Share This Page