Pass parameter from ASP.Net page to Cognos to create report

Posted on 2009-05-01
Last Modified: 2012-05-06
Hi Experts,

I have an ASP.NET webpage with a gridview in which I have placed a Hyperlink field whose value is my Order ID (the key to my SQL table). I have a Cognos report built with a prompt page where in you can choose the Order ID and it will give you details for that Order. The gridview shows cursory information for each unprocessed Order in the SQL table. My charge is this: to put an HTML Link in the GridView so that the person using that webpage can click on the Order ID link and produce a detailed report for that Order. I almost have it working except when I click on the HTML link it takes me to the Prompt page and I have to select the Order ID again from the Prompt page in order to produce the report for that Order. Is there any way to send a parameter with the Cognos report request so that it knows which Order I want to produce the report for, rather than having to re-select the Order ID on the Prompt page?

I have pasted my .aspx page code.


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CDARS_Acct_Placements._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >

<head runat="server">

    <title>Untitled Page</title>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <title>Untitled Page</title>

    <style type="text/css">






    <form id="form2" runat="server">

    <table bgcolor="#0B01C5">






                <asp:Label ID="lblHeader" runat="server" Font-Bold="True" Font-Italic="True" 

                    Font-Names="Times New Roman" Font-Size="XX-Large" Font-Underline="True" 

                    ForeColor="#FFFF99" Text="CDARS Placed Orders"></asp:Label>










    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 

        AutoGenerateColumns="False" BackColor="#FFFFAE" BorderColor="#0000CC" 

        BorderStyle="Solid" CellPadding="10" DataKeyNames="Order_ID" 

        DataSourceID="SqlDataSource1" Font-Bold="True" Font-Names="Trebuchet MS" 

        Font-Size="Small" GridLines="None" PageSize="15" HeaderStyle-Wrap="False">

        <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NextPrevious" 

            NextPageText="Next" Position="TopAndBottom" PreviousPageText="Prev" />

        <RowStyle HorizontalAlign="Left" VerticalAlign="Top" />


            <asp:TemplateField HeaderText="Processed">


                    <asp:CheckBox ID="Order_Processed" runat="server" AutoPostBack="true" 

                        Checked='<%# Databinder.Eval(Container.DataItem, "Order_Processed") %>' 

                        OnCheckedChanged="Check_Clicked" />


                <ItemStyle BackColor="White" />


            <asp:BoundField DataField="Order_ID" HeaderText="Order ID" 

                SortExpression="Order_ID" />

            <asp:HyperLinkField DataTextField = "Order_ID" runat="server" 

                    DataNavigateUrlFields ="Order_ID"

                    DataNavigateUrlFormatString = "http://essdev/cognos8.2/cgi-bin/cognos.cgi?;m=portal/report-viewer.xts&amp;ui.action=run&amp;ui.object=%2fcontent%2fpackage%5b%40name%3d%27CDARS%27%5d%2freport%5b%40name%3d%27CDARS%20Account%20Place%20Order%27%5d&amp;cv.ccurl=1&amp;"


                    HeaderText = "Click for Report" />    

            <asp:BoundField DataField="Cust_Customer1_Name" HeaderText="Cust1 Name" 

                SortExpression="Cust_Customer1_Name" >

                <HeaderStyle Wrap="False" />

                <ItemStyle Wrap="False" />


            <asp:BoundField DataField="Order_Customer2_Name" HeaderText="Cust2 Name" 

                SortExpression="Order_Customer2_Name" HtmlEncode="False" >

                <HeaderStyle Wrap="False" />

                <ItemStyle Wrap="False" />


            <asp:BoundField DataField="Order_Cust_Sig" HeaderText="Cust Sig?" 

                SortExpression="Order_Cust_Sig" />

            <asp:BoundField DataField="Order_Amount" HeaderText="Amount" 

                SortExpression="Order_Amount" DataFormatString="{0:C2}" 

                HtmlEncode="False" />

            <asp:BoundField DataField="Order_Placement_Date" HeaderText="Place Date" 

                SortExpression="Order_Placement_Date" DataFormatString="{0:d}" />

            <asp:BoundField DataField="Location_Name" HeaderText="Branch" 

                SortExpression="Location_Name" HtmlEncode="False" >

                <ItemStyle Wrap="False" />


            <asp:BoundField DataField="Order_LANID" HeaderText="Branch Rep" 

                SortExpression="Order_LANID" >

                <HeaderStyle Wrap="False" />

                <ItemStyle Wrap="False" />


            <asp:BoundField DataField="Order_Date" HeaderText="Submit Date/Time" 

                InsertVisible="False" ReadOnly="True" SortExpression="Order_Date" > 

                <HeaderStyle Wrap="False" />

                <ItemStyle Wrap="False" />



        <HeaderStyle Font-Bold="True" Font-Names="Trebuchet MS" Font-Underline="True" 

            ForeColor="#0000CC" Wrap="False" />

        <AlternatingRowStyle BackColor="White" BorderColor="Blue" BorderStyle="Solid" 

            BorderWidth="1px" ForeColor="Black" />


    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 

        ConnectionString="<%$ ConnectionStrings:CDARSConnectionString %>" 



        SelectCommand="SELECT [Order_ID], [Cust_Customer1_Name], [Order_Processed], [Order_Customer2_Name], [Order_Cust_Sig], [Order_Amount], [Order_Placement_Date], [Location_Name], [Order_LANID], [Order_Date] FROM [vw_CDARS_Order_Placements] WHERE ([Order_Processed] = @Order_Processed) ORDER BY [Order_ID] DESC">


            <asp:Parameter DefaultValue="False" Name="Order_Processed" Type="Boolean" />






Open in new window

Question by:taduh
    LVL 12

    Accepted Solution

    You can specify the prompt values on the URL to the report.  This document describes all the fun things you can do with URL's with Cognos:

    This is from the section you're interested in:
    Passing Prompt Answers
    To ignore the prompt page, the parameter run.prompt must be set to false. Otherwise, the
    prompt page will appear with your prompt answer as the highlighted selection.

    /content/package[@name='GO Sales and Retailers']/folder[@name='New
    Reports']/report[@name='product revenue - prompt']&ui.action=run&p_Product name=Bear

    Author Comment


    The information you provided is helpful. I was able to suppress the prompt page; the only trouble I'm having now is getting it to recognize the gridview field, Order_ID as containing the prompt value. If I  hard-code the Order ID like  p_Order_ID=165 the report will successfully run, but I'm looking for a way for it to take the Order ID associated with the selected line on the Gridview as the prompt value and create the report from that. Whenever I do something like p_Order_ID=Order_ID I get an error saying "Invalid format for numeric prompt 'Order_ID'." i.e. Its not resolving to the value of Order_ID in the gridview. Any ideas on how to make it do this?



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    Hi, In my previous Article  ( discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now