Home All Groups Group Topic Archive Search About
Author
11 Jun 2006 9:46 AM
Julia
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

Author
11 Jun 2006 1:30 PM
mnichols
Client-side javascript:
<input type=button value="Go Back" onclick="history.go(-1)">

Julia wrote:
Show quoteHide quote
> 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
Author
11 Jun 2006 1:47 PM
Julia
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
Show quoteHide quote
"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
>
Author
12 Jun 2006 9:57 AM
Prakash V
use btnBackToSearch.Attributes.Add("onclick","history.back()");

Regards,
Prakash.V
Show quoteHide quote
"Julia" <Ju***@discussions.microsoft.com> wrote in message
news:94FB581A-C78A-4A95-8400-BDE024528C8F@microsoft.com...
> 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
>>
Author
12 Jun 2006 3:45 AM
Steve C. Orr [MVP, MCSD]
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



Show quoteHide quote
"Julia" <Ju***@discussions.microsoft.com> wrote in message
news:4CC48E67-3AF4-4354-BC51-776E11A90C84@microsoft.com...
> 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
Author
12 Jun 2006 6:25 AM
Julia
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

Show quoteHide quote
"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" <Ju***@discussions.microsoft.com> wrote in message
> news:4CC48E67-3AF4-4354-BC51-776E11A90C84@microsoft.com...
> > 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
>
>
>
Author
13 Jun 2006 6:52 AM
Alessandro Zifiglio
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

Show quoteHide quote
"Julia" <Ju***@discussions.microsoft.com> ha scritto nel messaggio
news:E1E7106C-27AF-4A8A-BD62-0FFBBA177722@microsoft.com...
> 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" <Ju***@discussions.microsoft.com> wrote in message
>> news:4CC48E67-3AF4-4354-BC51-776E11A90C84@microsoft.com...
>> > 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
>>
>>
>>
Author
13 Jun 2006 7:19 AM
Alessandro Zifiglio
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
Show quoteHide quote
"Alessandro Zifiglio" <AlessandroZifiglio @ -h-o-t-m-a-i-l-c-o-m> ha scritto
nel messaggio news:ORBRsXrjGHA.1940@TK2MSFTNGP02.phx.gbl...
> 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" <Ju***@discussions.microsoft.com> ha scritto nel messaggio
> news:E1E7106C-27AF-4A8A-BD62-0FFBBA177722@microsoft.com...
>> 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" <Ju***@discussions.microsoft.com> wrote in message
>>> news:4CC48E67-3AF4-4354-BC51-776E11A90C84@microsoft.com...
>>> > 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
>>>
>>>
>>>
>
>