<asp:TemplateField HeaderText="ID" SortExpression="ID">
<ItemTemplate>
<asp:HyperLink ID="hl1" runat="server"
NavigateUrl='<%# String.Format("readfile.ashx?id={0}", Eval("ID") ) %>'
Text='<%# Eval("ID") %>' >
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
href="readfile.ashx?id=24"
this is what my handler code looks like
///
/// Summary description for $codebehindclassname$
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class readfile : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
ReportContext ctxReport = new ReportContext();
var r = from re in ctxReport.Report
where re.ID == Convert.ToInt32(context.Request["id"].ToString())
select re;
Report rReport = r.FirstOrDefault<Report>();
context.Response.Clear();
string t = rReport.ReportType.TypeName;
context.Response.ContentType = "application/pdf";
context.Response.OutputStream.Write(
rReport.ReportData.ToArray() , 0
, Convert.ToInt32(rReport.FileLength));
context.Response.End();
}
public bool IsReusable
{
get
{
return true;
}
}
}
No comments:
Post a Comment