|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
back to calling pageHi
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 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 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 > 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 >> 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>"); 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 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 > > > 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 >> >> >> 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 >>> >>> >>> > >
GridView override InitializePager columnSpan problem when using BoundField Visible=false
Need help on validation on a group of controls Page / UserControl OnInit Problem Where is Page.RegisterClientScriptBlock Available? how to raise SelectedIndexChange event? Determining item count of databound DropDownList CreateUserWizard - membership and roles checkbox weird Problem Customizing the Calendar Control Passing public properties to destination page |
|||||||||||||||||||||||