Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirecting from a user control

Status
Not open for further replies.

russellobrien

Programmer
May 14, 2003
28
GB
I have a user control in C# and when a selection in a drop list changes I catch this event in the user control itself and then try to use repsonse.redirect to the same page appending a query string base on the selection,

However, this doesn't work. Can anyone tell me how I do this from a user control or some way to reflect this event to the page itself?

Many thanks,

Russ
 
What exactly isn't working? Are you getting 404's?

If you're trying to redirect based on a parent path:

../../somefile.aspx?blah=foo

then try using root notation:

/applicationname/folder/file.aspx?blah=foo

so that no matter where the uc is in the directory structure of your application, the redirect path is the same.

-p

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
This is what I was thinking,
Response.Redirect(Request.ServerVariables["SCRIPT_NAME"] + "?qsName=" + qsValue);
Marty
 
That would also work, but it doesn't handle if you're trying to redirect to a different page than the one you're on.

-p

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
Thanks,

The main problem is not that I cannot go back to the page- it reloads ok rather that the selected index is not appended to the query string as I have programmed, or at least it is not recognised by the page on reload. I have the event redirecting but because the control autopastbacks I don't think it ever makes it into the event handler (at least I don't see trace evidence) but I presume the reload means the trace I see is only from the reload page.
I will put some brakpoints in and see where execution goes.

Russ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top