Hello,
I have a radrid with one column setup for printing the object associated with the ID of the row. Works great unless I ajaxify the grid either wrapping with an AJAX panel or using an ajax manager on the page then I get a javascript error on postback wchihc makes sense because the ajax manager or panel will be trying to interpret the response. How to I bypass the ajax panel for this one behaviour and have the browser rather than the ajax manager respond to the new contect header information?
Thanks
Jonathan
I have a radrid with one column setup for printing the object associated with the ID of the row. Works great unless I ajaxify the grid either wrapping with an AJAX panel or using an ajax manager on the page then I get a javascript error on postback wchihc makes sense because the ajax manager or panel will be trying to interpret the response. How to I bypass the ajax panel for this one behaviour and have the browser rather than the ajax manager respond to the new contect header information?
protected
void
radGridAll_ItemCommand(Object sender, GridCommandEventArgs e)
{
if
(e.CommandName !=
"Print"
)
return
;
Guid id = Guid.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][
"ID"
].ToString());
//lblMessage.Text = string.Empty;
switch
(e.CommandName)
{
case
"Print"
:
//string args = Request.QueryString["ApplicationID"];
NMotionServer.ApplicationLead _application = NMotionServer.ApplicationLeadService.GetByID(id);
if
(_application.LeadStatusID == (
int
)enumLeadStatus.Fresh || _application.LeadStatusID == (
int
)enumLeadStatus.Viewed)
{
AppHistory _leadStatusEvent =
new
AppHistory() { ApplicationLeadID = _application.ID, EventTypeID = 2, ForeignKeyID = (
int
)enumLeadStatus.Printed, Timestamp = DateTime.Now, UserProfileID = ((UserProfile)Session[
"_userProfile"
]).ID };
AppHistoryService.Save(_leadStatusEvent);
_application.LeadStatusID = (
int
)enumLeadStatus.Printed;
ApplicationLeadService.Save(_application);
}
//RptApplication _applicationReport = new RptApplication((DealerLinkServer.SalesForceWebReference.SforceService)Session["SalesForceBinding"], args);
RptApplication _applicationReport =
new
RptApplication(id.ToString());
ReportProcessor _processor =
new
ReportProcessor();
RenderingResult result = _processor.RenderReport(
"PDF"
, _applicationReport,
null
);
string
fileName =
"NMotion_Lead_"
+ _application.ApplicantNameLast2First.Replace(
" "
,
"_"
).Replace(
","
,
"_"
).Replace(
"'"
,
"_"
) +
"_"
+ _application.DateOfApplication.Year + _application.DateOfApplication.Month + _application.DateOfApplication.Day +
".pdf"
;
Response.Clear();
Response.ContentType = result.MimeType;
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.Expires = -1;
Response.Buffer =
true
;
Response.AddHeader(
"Content-Disposition"
,
string
.Format(
"{0};FileName=\"{1}\""
,
"attachment"
, fileName));
Response.BinaryWrite(result.DocumentBytes);
Response.End();
break
;
}
}
Thanks
Jonathan