I get an error (Server cannot set content type after HTTP headers have been sent.) on the following code (ContentType line). What should I change?
ContentType
I had a very similar issue to this on a webform. I solved this issue by adding the following code to my button in the code behind:
ScriptManager.GetCurrent(this).RegisterPostBackControl(btnPrint);