PDA

View Full Version : [CLOSED] Server side control in GridPanel???



t0ny
Oct 07, 2008, 6:50 AM
Hi there,

Well impressed with v0.6.0!!!!!! I have been regularly checking and got all excited like a little school girl when I saw the version number at the top of the site!!!

Anyways, with new features come new questions and I wonder if I could be pointed in the right direction.

I have a table that lists textfiles and you should be able to view or download them.

In my original working table, for each column, I have two clickable images in seperate cells. The first would pop up a window with the contents of the textfile displayed and the second would let the user download the textfile to their desktop.

I have the popupwindow opening correctly using the renderer property, but I am not sure how to allow a user to download the file?

I have looked using AjaxEvents 'RowDblClick', but I don't think this will work due to it returning JavaScript not HTML??

So, is there a way to place a server side control in the GridPanel so that when clicked it fires this code on the server??



byte[] binaryData = System.Text.ASCIIEncoding.UTF8.GetBytes(logFile);
Response.AddHeader("Content-disposition", "attachment; filename=" + filename);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(binaryData);
Response.End();


Thanks for any help/direction

geoffrey.mcgill
Oct 07, 2008, 8:57 AM
Hi t0ny,

Maybe I'm oversimplifying the problem, but could you not just make a link in one of the Columns and link directly to the file, or a Page that would package up the file and send back the Response as per your code sample?

t0ny
Oct 07, 2008, 10:05 AM
Hi Geoffrey,

Nope you have not oversimplified things linking to a page and packaging up the file and sending back the response working nicely!

Thanks again