Register
Login
Home
Silverlight 1.0
Silverlight Video
Silverlight XAML
Silverlight Album
Silverlight Custom Control
Silverlight ToolBar
Silverlight 2.0
Silverlight Webservice
Silverlight Dashboard
Silverlight FileUploader
Silverlight Dashboard 2
Silverlight Chat
Personal File Upload
Silverlight 3.0
Silverlight 3 Hello World
SketchFlow Viewer
Silverlight File Manager
WCF RIA Services
Silverlight Module Instance File Uploader
Silverlight Traffic
Silverlight 4.0
Silverlight Portal File Manager
Expense Report
Forums
FAQ
Installing Silverlight
About
Forums
(you must be logged in to post)
Unanswered
Active Topics
Forums
Search
Forums
>
DNN Silverlight Forum
>
Silverlight and DotNetNuke
Subject: Display PDF, Word, Excel File
Prev
Next
You are not authorized to post a reply.
Author
Messages
Oldest First
Newest First
eqx
Posts:23
03/29/2010 2:32 PM
Michael - Thanks for the HelloWorld3 example.
I am building DNN 5.2.3 Silverlight 3 module:
1) SqlServer 2005 table stores PDF, Excel, Word and TXT files in an IMAGE field.
2) Grid display list of files stored in SqlServer.
Upon selecting a file from the grid row, I would like to display the Excel, Word, etc file in a browser or ASPX page (Silverlight can not display). How does the Silverlight XAP open a window to display the selected file?
I did this under DNN 4 using 2 ASPX pages:
1) select.aspx: Button click passes the file ID to displayfile.aspx
Dim sz As String = "return window.open('" & Me.ModulePath & "displayfile.aspx')"
Me.btnGetDoc.Attributes.Add("onclick", sz)
2) displayfile.aspx: Retrieves the Image field file data and displays the file:
Response.ContentType = "application/pdf" '' OR EXCEL, WORD, etc
Dim bytes As Byte() = CType(mySqlDataReader, Byte())
Response.BinaryWrite(bytes)
Response.End()
Thanks for help
Michael Washington (admin)
Posts:202
03/29/2010 3:00 PM
I posted a tutorial at:
http://www.codeproject.com/KB/silverlight/SilverlightMVVMFileManagr.aspx
That contains an example of placing a link in Silverlight to download a file from a asp.net website.
eqx
Posts:23
03/30/2010 6:34 AM
Thanks, I have not reviewed your project but definitely will take a look.
I did get the module to work:
1) The Silverlight "MainPage.xaml.cs" opens a new window via:
System.Windows.Browser.HtmlPage.Window.Navigate( new Uri( "http://localhost/mySite/DesktopModules/DocViewer/displayfile.aspx" ), "_blank" );
** Question **
The URI is hardcoded. In "MainPage.xaml.cs" module, how can I obtain the Websites root url? This did not work.
new Uri( "~/DesktopModules/DocViewer/displayfile.aspx" )
I would like to build the path in code - something like:
string myURI = someDNNSilverlightGlobalVariable +
"/DesktopModules/DocViewer/displayfile.aspx"
2) I saved fileID between Silverlight module and other DNN modules via a Webservice call that saves the SqlServer record key:
Webservice.asmx
===============
System.Web.HttpContext context = System.Web.HttpContext.Current;
context.Cache["fileID"] = webServiceFileIDParamCalledFromSilverLight; 'string type
displayfile.aspx.vb ( code behind file )
========================================
Dim context As HttpContext = HttpContext.Current
Dim docKey As String = context.Cache("fileID").ToString()
Michael Washington (admin)
Posts:202
03/30/2010 6:44 AM
You can get the website root with code such as:
private string GetWebserviceAddress()
{
string strXapFile = @"/ClientBin/MVMFileManager.xap";
string strBaseWebAddress =
App.Current.Host.Source.AbsoluteUri.Replace(strXapFile, "");
return string.Format(@"{0}/{1}", strBaseWebAddress, @"WebService/WebService.asmx");
}
eqx
Posts:23
03/30/2010 6:51 AM
Works great. Thanks.
You are not authorized to post a reply.
DNN Silverlight Forum
--Silverlight and DotNetNuke
Forums
>
DNN Silverlight Forum
>
Silverlight and DotNetNuke
> Display PDF, Word, Excel File
ActiveForums 3.7
Terms Of Use
|
Privacy Statement
|
Copyright 2007-2008 by Adefwebserver.com
Dynnamite DotNetNuke Skins & Modules