By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,559 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,559 IT Pros & Developers. It's quick & easy.

Very Very Urgent - Please help me

P: n/a

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="CaseInformationSummar y.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
}
}

Nov 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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


"se****@gmail.com" wrote:
>
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="CaseInformationSummar y.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
}
}

Nov 15 '06 #2

P: n/a
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
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


"se****@gmail.com" wrote:

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="CaseInformationSummar y.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
}
}
Nov 15 '06 #3

P: n/a
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
<se****@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
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
>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


"se****@gmail.com" wrote:
>
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="CaseInformationSummar y.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
}
}


Nov 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.