Answered by:
Response.End() in Sandboxed Solution throws NullReferenceException

Question
-
Hi,
can I use
Context.Response.Write(
"<script type='text/javascript'>window.frameElement.commitPopup();</script>"); Context.Response.Flush();
Context.Response.End();in a sandboxed solution ?
Because I allways get a NullReferenceException when I call the End() in my Webpart Code Behind?Tuesday, July 5, 2011 12:01 PM
Answers
-
Hi,
It is a limitation in Sandboxed solution. Refer here : http://www.wictorwilen.se/Post/Understanding-the-SharePoint-2010-Sandbox-limitations.aspx
Regards
Ranga
Regards Ranga www.sharepointfrontier.com- Marked as answer by Shimin Huang Friday, July 15, 2011 7:45 AM
Tuesday, July 5, 2011 12:55 PM -
I have found a way to close my dialog.
Way 1 works, Way 2 not.
What´s the differnce in the sandbox ?
Way 1:
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Attributes.Add("OnClick", "window.frameElement.cancelPopUp(); return false;");
Controls.Add(btnCancel);
Way 2:
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Click += new EventHandler(Cancel_Click);
private void Cancel_Click(object sender, EventArgs e){
this.Context.Response.Write("<script type='text/javascript'>window.frameElement.cancelPopUp(); return false;</script>");
this.Context.Response.Flush();
this.Context.Response.End();
}
- Marked as answer by Shimin Huang Friday, July 15, 2011 7:45 AM
Tuesday, July 5, 2011 2:09 PM
All replies
-
Hi,
It is a limitation in Sandboxed solution. Refer here : http://www.wictorwilen.se/Post/Understanding-the-SharePoint-2010-Sandbox-limitations.aspx
Regards
Ranga
Regards Ranga www.sharepointfrontier.com- Marked as answer by Shimin Huang Friday, July 15, 2011 7:45 AM
Tuesday, July 5, 2011 12:55 PM -
I have found a way to close my dialog.
Way 1 works, Way 2 not.
What´s the differnce in the sandbox ?
Way 1:
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Attributes.Add("OnClick", "window.frameElement.cancelPopUp(); return false;");
Controls.Add(btnCancel);
Way 2:
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Click += new EventHandler(Cancel_Click);
private void Cancel_Click(object sender, EventArgs e){
this.Context.Response.Write("<script type='text/javascript'>window.frameElement.cancelPopUp(); return false;</script>");
this.Context.Response.Flush();
this.Context.Response.End();
}
- Marked as answer by Shimin Huang Friday, July 15, 2011 7:45 AM
Tuesday, July 5, 2011 2:09 PM