I have a Gridview that that has some radbuttons. One of them allows the user to fill the pdf document and another Radbutton displays the pdf besides GridView. Once I fill the pdf document and click on view pdf button the pdf opens fine besides the gridview. However, the problem is if I click Close button in the RadWindow. Click on Fill to fill the document and click on view pdf Radbutton again to open the pdf it does not open. I am not sure why. Please advise!
I have tried using
but that didn't help.
Here is some code from my application.
I have tried using
string script = "<script language='javascript'>function f(){ShowPDFDocument('" + title + "', '" + url + "');Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
Here is some code from my application.
<
telerik:RadAjaxPanel
runat
=
"server"
LoadingPanelID
=
"LoadingPanel1"
>
<
telerik:RadPageView
runat
=
"server"
ID
=
"tpDocuments"
>
<
asp:Panel
ID
=
"pnlDocuments"
CssClass
=
"Clear"
runat
=
"server"
>
<
div
id
=
"divDocuments"
>
<
asp:GridView
>
<
asp:TemplateField
ItemStyle-Width
=
"10%"
ItemStyle-HorizontalAlign
=
"Left"
HeaderStyle-BorderColor
=
"#2F4F4F"
ItemStyle-BorderColor
=
"#2F4F4F"
ItemStyle-VerticalAlign
=
"Top"
>
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"rdFill"
CssClass
=
"AddMargin"
CommandArgument
=
""
CommandName
=
"cnFill"
runat
=
"server"
CausesValidation
=
"False"
Icon-PrimaryIconUrl
=
"~/images/fill.gif"
Skin
=
"Vista"
Text
=
"Fill"
ToolTip
=
"Fill document"
/>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderStyle-BorderColor
=
"#2F4F4F"
ItemStyle-Width
=
"5%"
ItemStyle-BorderColor
=
"#2F4F4F"
HeaderText="View <br/>Doc" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Left">
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"imgViewImage"
runat
=
"server"
Width
=
"16px"
Height
=
"16px"
OnClick
=
"imgViewImage_Click"
ToolTip
=
"View Document"
>
<
Image
ImageUrl
=
"~/images/preview.gif"
IsBackgroundImage
=
"false"
/>
</
telerik:RadButton
>
</
ItemTemplate
>
</
asp:TemplateField
>
</
div
>
<
div
id
=
"divDisplayPDFDocument"
class
=
"divDisplayPDFDocument"
>
</
div
>
</
telerik:RadAjaxPanel
>
<
telerik:RadWindow
runat
=
"server"
ID
=
"PDFDocument"
OffsetElementID
=
"divDisplayPDFDocument"
Modal
=
"false"
Behaviors
=
"Close"
VisibleStatusbar
=
"false"
VisibleTitlebar
=
"True"
ReloadOnShow
=
"true"
RestrictionZoneID
=
"divDisplayPDFDocument"
InitialBehaviors
=
"Close"
>
</
telerik:RadWindow
>
<
telerik:RadWindow
runat
=
"server"
ID
=
"PDFWindow"
Modal
=
"true"
Behaviors
=
"Close, Resize"
VisibleStatusbar
=
"false"
VisibleTitlebar
=
"True"
InitialBehaviors
=
"Close, Resize"
ShowContentDuringLoad
=
"true"
VisibleOnPageLoad
=
"false"
ReloadOnShow
=
"true"
Overlay
=
"true"
OnClientBeforeClose
=
"PDFWindowBeforeClose"
Width
=
"800px"
Height
=
"600px"
>
</
telerik:RadWindow
>
Server side code
string title = System.IO.Path.GetFileNameWithoutExtension(tmpDir);
string url = "ViewFilingPreview.aspx?length=" + doc.Filesize + "&ext=" + System.IO.Path.GetExtension(tmpDir).Replace(".", "") + "&file=" + System.IO.Path.GetFileNameWithoutExtension(tmpDir);
string script = "ShowPDFDocument('" + title + "', '" + url + "');";
ScriptManager.RegisterStartupScript(this, GetType(), "ShowPDF", script, true);
Client Side code
function ShowPDFDocument(title, url) {
var oWnd = $find("<%= PDFDocument.ClientID %>");
oWnd.set_title(title);
oWnd.setUrl(url);
SetPDFSize(oWnd);
// oWnd.set_restrictionZoneID("divDisplayPDFDocument");
// oWnd.argument = title;
// oWnd.remove_pageLoad(windowLoad);
// oWnd.add_pageLoad(windowLoad);
oWnd.show();
}