Very Very Urgent - Please help me

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
}
}
 
G

Guest

First off, let me just say that "Very Very Urgent - Please help me" is a
pretty lousy choice of a subject line. Most people (Including me) find this
kind of approach a turn-off, and many people won't even respond to such a
post.

Bone up on your Netiquette and learn to provide a descriptive subject line.

Your eventhandler has the "e" parameter of type DataGridCommandEventArgs,
take a look at the properties it exposes. The "Item" property give you a
reference to the row in which the control was clicked.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
S

settyv

Hi,

I apologize for giving the weird subject line.Now the problem with
the datagrid display.

<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>

When i use the above code,it displays the DMS ID which i should
not,instead i should display View .How can i do that? Please suggest me
the solution.


It has to display as shown below:

Minute Order
View
View
View
View
View


Thanks,
Vishnu
 
M

Milsnips

Hi there,

use this line: Text='View' CommandArgument='<%# DataBinder.Eval(Container,
"DMSId") %>'

Then, on the repeater_itemCommand event, check if e.item.commandName="View",
and if so, do your code here.
And to get the value of the DMS ID, it is stored in e.Item.CommandArgument.

regards,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top