SurfaceController RedirectToCurrentUmbracoPage with querystring
Guys,
Using umbraco 616 and in my surfacecontroller I do return RedirectToCurrentUmbracoPage(); what i also want to do is pass through a querystring well its actually an anchor so something like #review--thanks so when page loads it jumps to that anchor. How do i do this? Route hijack?
Issue is this is a partial so it will ysod. Additionally doing redirect will throw exception under the hood which will be logged in elmah, so after thinking about this a bit more, I will in the view test for a tempdata field i already set then just put some js in there to do the scroll to anchor.
I'm trying to do this very thing...after postback display message and scroll to bottom of the page where the contact form is...could you explain how it was done? Can we not add something to RedirectToCurrentUmbracoPage()?
try
{
umbraco.library.SendMail(sendEmailsFrom, sendEmailsTo, subject, body, true);
TempData["InfoMessage"] = "Your message has been successfully sent and we will be in touch soon...";
// Clear all the form fields
ModelState.Clear();
model.FullName = string.Empty;
model.Company = string.Empty;
model.Telephone = string.Empty;
model.Email = string.Empty;
model.Message = string.Empty;
//redirect to current page to clear the form
return RedirectToCurrentUmbracoPage();
}
catch (Exception ex)
{
TempData["ErrorMessage"] = "There was an issue sending your message: " + ex.Message + ex.StackTrace;
}
SurfaceController RedirectToCurrentUmbracoPage with querystring
Guys,
Using umbraco 616 and in my surfacecontroller I do return RedirectToCurrentUmbracoPage(); what i also want to do is pass through a querystring well its actually an anchor so something like #review--thanks so when page loads it jumps to that anchor. How do i do this? Route hijack?
Regards
Ismail
There's probably a better way, but how about ....
(Untested) :D
Hi Ismall
There is a property on the RedirectToCurrentUmbracoPage() i think called URL something like that. I did something like
string url = RedirectToCurrentUmbracoPage().Url
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(url).append("?...")
Response.Redirect(Url);
Hope this helps.
Charlie
Charles, Dan,
Issue is this is a partial so it will ysod. Additionally doing redirect will throw exception under the hood which will be logged in elmah, so after thinking about this a bit more, I will in the view test for a tempdata field i already set then just put some js in there to do the scroll to anchor.
Regards
Ismail
Ismll why yellow screen of death? and let us know how you get on with that approach :)
Charlie
Charles,
My tempdata hack works nicely.
Regards
Ismail
Great glad you got it working :)
I'm trying to do this very thing...after postback display message and scroll to bottom of the page where the contact form is...could you explain how it was done? Can we not add something to RedirectToCurrentUmbracoPage()?
is working on a reply...