Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Grid Click + Function

$
0
0
Re: Grid Click + Function
Web Connection 5.0
Re: Grid Click + Function
Apr. 17, 2013
11:40 am
3RI0P10DJShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:David Pedrelli
David,

It'd be more efficient to just create a Process class method for the download.

Alternately you can also make the link point to the current page and fire like a button event using GetPostbackEventReference().

To fire an even from an HREF() in your grid you can use something like this:

<ww:wwWebDataGridColumnrunat="server"ID="WwWebDataGridColumn1" Expression="HREF( this.Page.GetPostbackEventReference('Page','ShowPdf',Trans(pk),.t.) ,[Show Pdf])" HeaderText="Action">

Then inside your form you just define the event method:

FUNCTION ShowPdf(pk)*** do whatever here to get your PDF lcPdf = FileToStr(lcPdfFile) Response.ContentType("application/pdf") Response.Write(lcPdf) Response.End()ENDFUNC


+++ Rick ---


Rick,

That is kind of what I did. I created a new wwWebPage just for downloading. I have an HREF that points to it and passes the ID of the file that I want to download. The OnLoad reads the URL parameter and downloads the file. Interestingly, the new wwWebPage does not even display. It downloads the file and stays on the current wwWebPage.

Although, your solution reminds me that I wrote a WC app several years ago just for downloading JPEGs that I did not want accessible from the public Web site. I create a script map for .jpg, which points to the WC app.

Thanks,

David


Sure you can put a button in the grid. You'll need some sort of ID and then just call:

Expression="HREF([MyDownloadFile.ext?id=412312],[Download])"

IOW, you just create a column that includes a link back to the server. The server side code can then run and do the DownloadFile() logic to actually serve the file.

+++ Rick ---


Hi,

I want to display a list of files in a grid, click a row, and call DownloadFile. The files are not accessible via the public Web site; therefore, a standard HREF won't work. Is it possible to put an HREF in a grid that calls a code behind function, passing a parameter? If not, is it possible to put a button in a grid?

Thanks,

David






Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles