G
George Durzi
I have a DataGrid which contains 1 visible column which is a LinkButton:
<Columns>
<asp:BoundColumn DataField="ProductId"
Visible="False"></asp:BoundColumn>
<asp:BoundColumn DataField="DownloadURL"
Visible="False"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="lnkArticle" Runat="server"
Text='<%#DataBinder.Eval(Container, "DataItem.Title")%>'
CommandName="Select" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
The data source is a table of PDF files. It contains the Id, the path to the
file, and the title of the file. On the SelectCommand event of the DataGrid,
all I'm doing is streaming the PDF file to the browser:
protected void dgReader_OnSelectedIndexChanged(object sender,
System.EventArgs e){
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(dgReader.SelectedItem.Cells[1].Text);
Response.Flush();
Response.Close();
}
When I click the select button, I'd like the streaming of the PDF to happen
in a new window.
One very important thing is that I can't pass a query string in the URL (to
prevent URL tampering). Of course, I could do this with a Guid if that's
what it came down to.
Thanks a million for your help
<Columns>
<asp:BoundColumn DataField="ProductId"
Visible="False"></asp:BoundColumn>
<asp:BoundColumn DataField="DownloadURL"
Visible="False"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="lnkArticle" Runat="server"
Text='<%#DataBinder.Eval(Container, "DataItem.Title")%>'
CommandName="Select" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
The data source is a table of PDF files. It contains the Id, the path to the
file, and the title of the file. On the SelectCommand event of the DataGrid,
all I'm doing is streaming the PDF file to the browser:
protected void dgReader_OnSelectedIndexChanged(object sender,
System.EventArgs e){
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.WriteFile(dgReader.SelectedItem.Cells[1].Text);
Response.Flush();
Response.Close();
}
When I click the select button, I'd like the streaming of the PDF to happen
in a new window.
One very important thing is that I can't pass a query string in the URL (to
prevent URL tampering). Of course, I could do this with a Guid if that's
what it came down to.
Thanks a million for your help