S
settyv
Hi,
I need to generate PDF stream when i click on Linkbutton in datagrid
..At present i hardcoded the
DMS Id and now it is working.But i need to pass DMS ID when click
linkbutton.How can i do that?
Here is the ASPX code:
<asp:datagrid id="grdTentativeResults" Width="800" Runat="server"
AutoGenerateColumns="False"
PageSize="50" PagerStyle-Position="TopAndBottom"
PagerStyle-HorizontalAlign="Left" PagerStyle-VerticalAlign="Middle"
HeaderStyle-Font-Bold="True" HeaderStyle-ForeColor="#000000"
HeaderStyle-CssClass="tableheader" AllowSorting="true"
AllowCustomPaging="false" Font-Name="verdana"
PagerStyle-Mode="NumericPages" OnPageIndexChanged="NewPage"
AllowPaging="True" Headerstyle-BackColor="#9B9BB4">
<AlternatingItemStyle BackColor="#e2e2e2" Font-Name="verdana"
/>
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Case Number"
DataNavigateUrlFormatString="CaseInformationSummary.aspx?CaseNo={0}"
DataTextField="Case Number" HeaderText="Case
Number"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="Short Case Title"
HeaderText="Case Title" />
<asp:BoundColumn DataField="Event Type" HeaderText="Event
Type" />
<asp:BoundColumn DataField="Event Date" HeaderText="Event
Date" />
<asp:BoundColumn DataField="Event Time" HeaderText="Event
Time" />
<asp:BoundColumn DataField="Department"
HeaderText="Department" />
<asp:BoundColumn DataField="DMS Id"
Visible=False></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Minute Order" >
<ItemTemplate>
<asp:LinkButton ID="linkView" runat="server"
CausesValidation="false" CommandName="View"
Text='<%# DataBinder.Eval(Container, "DMS Id")
%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Code-Behind:
public void GetPDFDoc()
{
//Tentative tr=new Tentative();
Minute min=new Minute();
MemoryStream pdfStream = new MemoryStream();
SearchParams sp=new SearchParams();
sp.DmsID="2005";
pdfStream = min.GetMinuteOrderPdf(sp);
Response.Clear();
Response.Charset = "";
Response.ContentType = "application/pdf";
Response.AddHeader( "content-length", System.Convert.ToString(
pdfStream.Length ) );
Response.BinaryWrite( pdfStream.ToArray() );
Response.End();
}
private void grdTentativeResults_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName == "View")
{
GetPDFDoc();//need to pass DMSID
}
}
I need to generate PDF stream when i click on Linkbutton in datagrid
..At present i hardcoded the
DMS Id and now it is working.But i need to pass DMS ID when click
linkbutton.How can i do that?
Here is the ASPX code:
<asp:datagrid id="grdTentativeResults" Width="800" Runat="server"
AutoGenerateColumns="False"
PageSize="50" PagerStyle-Position="TopAndBottom"
PagerStyle-HorizontalAlign="Left" PagerStyle-VerticalAlign="Middle"
HeaderStyle-Font-Bold="True" HeaderStyle-ForeColor="#000000"
HeaderStyle-CssClass="tableheader" AllowSorting="true"
AllowCustomPaging="false" Font-Name="verdana"
PagerStyle-Mode="NumericPages" OnPageIndexChanged="NewPage"
AllowPaging="True" Headerstyle-BackColor="#9B9BB4">
<AlternatingItemStyle BackColor="#e2e2e2" Font-Name="verdana"
/>
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Case Number"
DataNavigateUrlFormatString="CaseInformationSummary.aspx?CaseNo={0}"
DataTextField="Case Number" HeaderText="Case
Number"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="Short Case Title"
HeaderText="Case Title" />
<asp:BoundColumn DataField="Event Type" HeaderText="Event
Type" />
<asp:BoundColumn DataField="Event Date" HeaderText="Event
Date" />
<asp:BoundColumn DataField="Event Time" HeaderText="Event
Time" />
<asp:BoundColumn DataField="Department"
HeaderText="Department" />
<asp:BoundColumn DataField="DMS Id"
Visible=False></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Minute Order" >
<ItemTemplate>
<asp:LinkButton ID="linkView" runat="server"
CausesValidation="false" CommandName="View"
Text='<%# DataBinder.Eval(Container, "DMS Id")
%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Code-Behind:
public void GetPDFDoc()
{
//Tentative tr=new Tentative();
Minute min=new Minute();
MemoryStream pdfStream = new MemoryStream();
SearchParams sp=new SearchParams();
sp.DmsID="2005";
pdfStream = min.GetMinuteOrderPdf(sp);
Response.Clear();
Response.Charset = "";
Response.ContentType = "application/pdf";
Response.AddHeader( "content-length", System.Convert.ToString(
pdfStream.Length ) );
Response.BinaryWrite( pdfStream.ToArray() );
Response.End();
}
private void grdTentativeResults_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName == "View")
{
GetPDFDoc();//need to pass DMSID
}
}