Saqib Malick

Saqib Malick

  • NA
  • 23
  • 0

How to use Crystal Report Selection Formula manually in my Crystal Report page.

Sep 4 2008 7:40 AM

Hello,

I have Link button on each gridview row and I want to take priview of that row through Crystal Report viewer when I click on Link Button on Gridview row. 

In this  CrystalReports1.aspx.cs page I am using record number '35' and it is showing this record correctly but I want to view the each record which is clicked on Linkbutton.

 Default.aspx

<asp:TemplateField>

<ItemTemplate>

<asp:LinkButton ID = "commandSelect" text = "Preview" Runat="Server" OnClick="commandSelect_Click"/>

</ItemTemplate>

</asp:TemplateField>

Default.aspx

protected void commandSelect_Click(object sender, EventArgs e)

{

 

LinkButton btn = new LinkButton();

btn = (LinkButton)sender;

GridViewRow grdRow = ((GridViewRow)btn.Parent.Parent);string keyID;

keyID = grdRow.Cells[1].Text.Trim();

//where Cells[1] is the column index where you store your primary key

Session["Quotation_No"] = keyID;this.Response.Redirect("CrystalReports1.aspx");

}

CrystalReports1.aspx.cs

protected void Page_Load(object sender, EventArgs e)

{

 // Here I want to change but not aware how to apply code when click on Link Button.

this.CrystalReportViewer1.SelectionFormula = "{Quotation_Master.QUOTATION_NO} = 35";

}


Regards,

Saqib