I have a DropDownList
that lets the user change the themed stylesheet for a website. It does an autopostback to save the selection to my database. After this saves I want to force a complete page reload (not refresh). So the link to the stylesheet is rebuilt and the form is reset. Is this possible?
I have tried both:
Response.Redirect(Request.Url.AbsoluteUri)
Response.Redirect(Request.RawUrl)
And even tried JavaScript:
window.location.reload();
window.opener.location.href = window.opener.location.href;
but these just seem to cause a refresh. I seek a way that acts as if I clicked in the address bar and pressed [Enter]
.
UPDATE
This was a common case of not thinking things through thoroughly. I was attempting to do these actions through an iframe
but the parent page was actually the one that set the theme stylesheet. I ended up getting this accomplished by simply:
If IsPostBack() Then
Dim sb As New StringBuilder()
sb.Append("<script type=""text/javascript"">")
sb.Append("window.top.location.reload();")
sb.Append("</script>")
ClientScript.RegisterStartupScript(Me.GetType(), "reload", sb.ToString())
End If
Thanks everyone.