views:

722

answers:

2

i have provided a button to change theme of website.in onclick event handler of the button.i am making change in web confif file page section's theme attribute.but on postback theme is not changed untill i do one more postback.so i want to postback pa explicitly in eventhandler of button.

+1  A: 

Maybe it is not the best solution, but I know it is possible to do the following:

Server.Transfer(Page.Request.RawUrl)

You need to put that code inside your click event. That way, it will "reload" the page.

But if you change your theme you can do the following to apply it directly to the page:

Page.Theme = "BlueTheme";
Nordes
+1  A: 
Response.Redirect(Request.Url.ToString())

That will refresh the page once more. Make sure to test for postback before this code, otherwise you'll get into one of those oh so fun infinite loops.

MasterMax1313