Response.redirect in ASCX

906 views
Skip to first unread message

abhya

unread,
Sep 29, 2008, 6:59:19 AM9/29/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hello,

I have created two DefaultPages ie default1.htm and default2.htm using
Frameset and frames.
Based on Drop down selection which is a part (a control) of an
UserControl, existed(a user control builded using two .net controls --
ddl and Go button) on a Top Frame of both the default pages;and after
clicking an Go button
I have to redirect the user from default1.htm to default2.htm or vice
a versa. the path about default pages is comming from Database.

I am using Go button a ASp.NEt control.
On its cilck event, control comes at server code (ie event handler of
go button in ascx.cs file) . In that I have fetch the redirecting URL
from database. And then I have use
Response.Redirect(PageUrl, false);
But it WON'T Works.
I have also tried Server.transfer(PageUrl);

Using javascript ie winodwas.top.location.href ='page.htm' calling on
onClientClick of go button.
It works fine. So that I have tried Response.Write("Javascript...etc
etc"); but this also WON'T Works.
I have also tried
Page.ClientScript.registerStartUpScript("Javascript...etc etc")
This also WON'T Works.
Does all this happens because of I am coding in "ascx.cs" file ie a
code behind file for UserControl or i am doing some thing wrog?
(Which is used in a top frame of both default.htm pages).

People please guid me on this issue.
Thank you in advanced.


Ramesh A

unread,
Sep 29, 2008, 11:44:48 PM9/29/08
to DotNetDe...@googlegroups.com
Yes,Response and Request contexts are available only  Page classes.Theses contexts are not available in user controls. If you need to use it in ascx also then use HttpContext.Current.Request,HttpContext.Current.Rresponse.

2008/9/29 abhya <abhijit...@gmail.com>

abhya

unread,
Oct 14, 2008, 9:01:10 AM10/14/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Thanks for the reply.
But Still it won't works.
Using Javascriot it works but need to fecth some details and hence
server trip is must.
Any approch to call server side function from javascript ..
thnk u again!

On Sep 30, 8:44 am, "Ramesh A" <arem...@gmail.com> wrote:
> Yes,Response and Request contexts are available only  Page classes.Theses
> contexts are not available in user controls. If you need to use it in ascx
> also then use HttpContext.Current.Request,HttpContext.Current.Rresponse.
>
> 2008/9/29 abhya <abhijit.dalv...@gmail.com>
> > Thank you in advanced.- Hide quoted text -
>
> - Show quoted text -

Shoriful Islam

unread,
Oct 14, 2008, 9:20:38 AM10/14/08
to DotNetDe...@googlegroups.com
Yes you can call server code using asp.net page method.
this link will help you.

Cerebrus

unread,
Oct 14, 2008, 12:23:11 PM10/14/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
You've gotta be kidding me !!

All UserControls have Request/Response properties which map to the
respective properties in the containing page.

On Sep 30, 8:44 am, "Ramesh A" <arem...@gmail.com> wrote:
> Yes,Response and Request contexts are available only  Page classes.Theses
> contexts are not available in user controls. If you need to use it in ascx
> also then use HttpContext.Current.Request,HttpContext.Current.Rresponse.
>
> 2008/9/29 abhya <abhijit.dalv...@gmail.com>
Reply all
Reply to author
Forward
0 new messages