ReportViewer - Add a dropdown or checkbox to the content

Discussion in 'ASP .Net' started by checkraiser@community.nospam, Oct 29, 2008.

  1. Guest

    I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing
    an .RLDC report in local report.

    The columns for the report are essentially:

    Month Item #1 Item#2 Item#3

    I would like to add a checkbox or dropdown control to the .RLDC and have
    Item #1, Item #2, or Item #3 display conditionally based on a checkbox being
    clicked or a dropdown value being selected.

    Is there a way to do this?
     
    , Oct 29, 2008
    #1
    1. Advertising

  2. Hi,

    From your description you want to group or filter the data shown on the
    ReportViewer, right? If so I'd lilke to demonstrate how to do this step by
    step using a DropDownList on the page.

    1. Prepare a test data table in your database. The data table has two
    columns:
    theID PK int
    theName nvarchar

    Insert arbitrary records into this table, such as:

    theID theName
    19 Allen
    20 Peter
    21 Marry
    44 Linda
    444 Jerry
    666 Tom
    667 Jack
    668 Steven

    2. Drag and drop a ReportViewer control on the page. In design view, right
    click the control and select "Show Smart Tag". On the popup window click
    the "Design a new report". Follow the instructions provided by the wizard
    to link the report to the datatable.

    3. Double click the created rdlc file in the solution explorer window to
    open it. In the properties window find the "ReportParameters" property,
    click the value field in this item and click the "¡­" button on the right
    side to open the "Report Properties" window.

    4. Click the "Add" button on the left bottom side to add a new parameter to
    this report. Set the Name "theID" as the Name, "Integer" as Data Type and
    "theID" as Prompt. Uncheck the "Null" checkbox on the window to allow
    default value to this parameter. Then input "=20" in the textbox beside the
    checkbox. Click "OK" button.

    5. In the design view of the rdlc file, select the "table1" Table, right
    click it and click "Properties" to open the "Table Properties" window.
    Select the "Filters" tab. Set "=Fields!theID.Value" as the Expression, "<"
    as the operator and "=Parameters!theID.Value" as the Value. Cllick "OK"
    button.

    6. Shift to the design view of the page, right click the ReportViewer
    control, click "Show Smart Tab", choose the newly created rdlc file as the
    report.

    7. Start debugging to test. If everything is normal we can only see the "19
    Allen" record in the report.

    8. In the source view of the page, add following code:

    <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True"
    onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    <asp:ListItem Text="20" Value="20"></asp:ListItem>
    <asp:ListItem Text="500" Value="500"></asp:ListItem>
    <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    </asp:DropDownList>
    In the aspx.cs of the page, add following code:
    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs
    e)
    {
    Microsoft.Reporting.WebForms.ReportParameter[] p = new
    Microsoft.Reporting.WebForms.ReportParameter[1];
    p[0] = new Microsoft.Reporting.WebForms.ReportParameter("theID",
    this.DropDownList3.SelectedValue);
    this.ReportViewer1.LocalReport.SetParameters(p);
    }

    Here the "ReportViewer1" is the ID of the ReportViewer control.

    9. Start debugging to test. When the selected item in the DropDownList get
    changed we'll see different records in the report.

    Please have a try and let me know if it works. If it's not what you need
    please clarify your requirement.


    Regards,
    Allen Chen
    Microsoft Online Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    | Thread-Topic: ReportViewer - Add a dropdown or checkbox to the content
    | thread-index: Ack563il5nDFokv7RBe6ypk+Hx7X6Q==
    | X-WBNR-Posting-Host: 65.55.12.11
    | From: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ==?=
    <>
    | Subject: ReportViewer - Add a dropdown or checkbox to the content
    | Date: Wed, 29 Oct 2008 10:26:26 -0700
    | Lines: 15
    | Message-ID: <>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | charset="Utf-8"
    | Content-Transfer-Encoding: 7bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | Content-Class: urn:content-classes:message
    | Importance: normal
    | Priority: normal
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Path: TK2MSFTNGHUB02.phx.gbl
    | Xref: TK2MSFTNGHUB02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:78886
    | NNTP-Posting-Host: tk2msftsbfm01.phx.gbl 10.40.244.148
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | I have a VS 2008 ASP.NET webform that has a reportview tag on it,
    accessing
    | an .RLDC report in local report.
    |
    | The columns for the report are essentially:
    |
    | Month Item #1 Item#2 Item#3
    |
    | I would like to add a checkbox or dropdown control to the .RLDC and have
    | Item #1, Item #2, or Item #3 display conditionally based on a checkbox
    being
    | clicked or a dropdown value being selected.
    |
    | Is there a way to do this?
    |
    |
    |
    |
     
    Allen Chen [MSFT], Oct 30, 2008
    #2
    1. Advertising

  3. Guest

    Allen,

    On this step, you're adding the dropdown control to the page with the
    reportviewer on it, so that it appears above or below the report itself. I
    want the dropdown or checkbox list to appear in the report itself in the
    header section. Is this possible?

    Ian

    > 8. In the source view of the page, add following code:
    >
    > <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True"
    > onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    > <asp:ListItem Text="20" Value="20"></asp:ListItem>
    > <asp:ListItem Text="500" Value="500"></asp:ListItem>
    > <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    > </asp:DropDownList>


    "Allen Chen [MSFT]" wrote:

    > Hi,
    >
    > From your description you want to group or filter the data shown on the
    > ReportViewer, right? If so I'd lilke to demonstrate how to do this step by
    > step using a DropDownList on the page.
    >
    > 1. Prepare a test data table in your database. The data table has two
    > columns:
    > theID PK int
    > theName nvarchar
    >
    > Insert arbitrary records into this table, such as:
    >
    > theID theName
    > 19 Allen
    > 20 Peter
    > 21 Marry
    > 44 Linda
    > 444 Jerry
    > 666 Tom
    > 667 Jack
    > 668 Steven
    >
    > 2. Drag and drop a ReportViewer control on the page. In design view, right
    > click the control and select "Show Smart Tag". On the popup window click
    > the "Design a new report". Follow the instructions provided by the wizard
    > to link the report to the datatable.
    >
    > 3. Double click the created rdlc file in the solution explorer window to
    > open it. In the properties window find the "ReportParameters" property,
    > click the value field in this item and click the "¡­" button on the right
    > side to open the "Report Properties" window.
    >
    > 4. Click the "Add" button on the left bottom side to add a new parameter to
    > this report. Set the Name "theID" as the Name, "Integer" as Data Type and
    > "theID" as Prompt. Uncheck the "Null" checkbox on the window to allow
    > default value to this parameter. Then input "=20" in the textbox beside the
    > checkbox. Click "OK" button.
    >
    > 5. In the design view of the rdlc file, select the "table1" Table, right
    > click it and click "Properties" to open the "Table Properties" window.
    > Select the "Filters" tab. Set "=Fields!theID.Value" as the Expression, "<"
    > as the operator and "=Parameters!theID.Value" as the Value. Cllick "OK"
    > button.
    >
    > 6. Shift to the design view of the page, right click the ReportViewer
    > control, click "Show Smart Tab", choose the newly created rdlc file as the
    > report.
    >
    > 7. Start debugging to test. If everything is normal we can only see the "19
    > Allen" record in the report.
    >
    > 8. In the source view of the page, add following code:
    >
    > <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True"
    > onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    > <asp:ListItem Text="20" Value="20"></asp:ListItem>
    > <asp:ListItem Text="500" Value="500"></asp:ListItem>
    > <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    > </asp:DropDownList>
    > In the aspx.cs of the page, add following code:
    > protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs
    > e)
    > {
    > Microsoft.Reporting.WebForms.ReportParameter[] p = new
    > Microsoft.Reporting.WebForms.ReportParameter[1];
    > p[0] = new Microsoft.Reporting.WebForms.ReportParameter("theID",
    > this.DropDownList3.SelectedValue);
    > this.ReportViewer1.LocalReport.SetParameters(p);
    > }
    >
    > Here the "ReportViewer1" is the ID of the ReportViewer control.
    >
    > 9. Start debugging to test. When the selected item in the DropDownList get
    > changed we'll see different records in the report.
    >
    > Please have a try and let me know if it works. If it's not what you need
    > please clarify your requirement.
    >
    >
    > Regards,
    > Allen Chen
    > Microsoft Online Support
    >
    > Delighting our customers is our #1 priority. We welcome your comments and
    > suggestions about how we can improve the support we provide to you. Please
    > feel free to let my manager know what you think of the level of service
    > provided. You can send feedback directly to my manager at:
    > .
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
    >
    > Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 2 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions. Issues of this
    > nature are best handled working with a dedicated Microsoft Support Engineer
    > by contacting Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    > ==================================================
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    > --------------------
    > | Thread-Topic: ReportViewer - Add a dropdown or checkbox to the content
    > | thread-index: Ack563il5nDFokv7RBe6ypk+Hx7X6Q==
    > | X-WBNR-Posting-Host: 65.55.12.11
    > | From: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ==?=
    > <>
    > | Subject: ReportViewer - Add a dropdown or checkbox to the content
    > | Date: Wed, 29 Oct 2008 10:26:26 -0700
    > | Lines: 15
    > | Message-ID: <>
    > | MIME-Version: 1.0
    > | Content-Type: text/plain;
    > | charset="Utf-8"
    > | Content-Transfer-Encoding: 7bit
    > | X-Newsreader: Microsoft CDO for Windows 2000
    > | Content-Class: urn:content-classes:message
    > | Importance: normal
    > | Priority: normal
    > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
    > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    > | Path: TK2MSFTNGHUB02.phx.gbl
    > | Xref: TK2MSFTNGHUB02.phx.gbl
    > microsoft.public.dotnet.framework.aspnet:78886
    > | NNTP-Posting-Host: tk2msftsbfm01.phx.gbl 10.40.244.148
    > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    > |
    > | I have a VS 2008 ASP.NET webform that has a reportview tag on it,
    > accessing
    > | an .RLDC report in local report.
    > |
    > | The columns for the report are essentially:
    > |
    > | Month Item #1 Item#2 Item#3
    > |
    > | I would like to add a checkbox or dropdown control to the .RLDC and have
    > | Item #1, Item #2, or Item #3 display conditionally based on a checkbox
    > being
    > | clicked or a dropdown value being selected.
    > |
    > | Is there a way to do this?
    > |
    > |
    > |
    > |
    >
    >
     
    , Oct 30, 2008
    #3
  4. Hi Lan,

    Unfortunately as far as I know the ReportViewer control doesn't support
    this natively. What I can suggest is to use absolute position to let
    DropDownList float over the report. This is the only way I can think of.

    Please feel free to ask if you have other questions.

    Regards,
    Allen Chen
    Microsoft Online Support

    --------------------
    | Thread-Topic: ReportViewer - Add a dropdown or checkbox to the content
    | thread-index: Ack6sRZste9TyqVWQ+q8RDAKtCqVEQ==
    | X-WBNR-Posting-Host: 65.55.12.11
    | From: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ==?=
    <>
    | References: <>
    <Ki#>
    | Subject: RE: ReportViewer - Add a dropdown or checkbox to the content
    | Date: Thu, 30 Oct 2008 10:01:01 -0700
    | Lines: 173
    | Message-ID: <>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | charset="Utf-8"
    | Content-Transfer-Encoding: 8bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | Content-Class: urn:content-classes:message
    | Importance: normal
    | Priority: normal
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Path: TK2MSFTNGHUB02.phx.gbl
    | Xref: TK2MSFTNGHUB02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:78954
    | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | Allen,
    |
    | On this step, you're adding the dropdown control to the page with the
    | reportviewer on it, so that it appears above or below the report itself.
    I
    | want the dropdown or checkbox list to appear in the report itself in the
    | header section. Is this possible?
    |
    | Ian
    |
    | > 8. In the source view of the page, add following code:
    | >
    | > <asp:DropDownList ID="DropDownList3" runat="server"
    AutoPostBack="True"
    | > onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    | > <asp:ListItem Text="20" Value="20"></asp:ListItem>
    | > <asp:ListItem Text="500" Value="500"></asp:ListItem>
    | > <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    | > </asp:DropDownList>
    |
    | "Allen Chen [MSFT]" wrote:
    |
    | > Hi,
    | >
    | > From your description you want to group or filter the data shown on the
    | > ReportViewer, right? If so I'd lilke to demonstrate how to do this step
    by
    | > step using a DropDownList on the page.
    | >
    | > 1. Prepare a test data table in your database. The data table has two
    | > columns:
    | > theID PK int
    | > theName nvarchar
    | >
    | > Insert arbitrary records into this table, such as:
    | >
    | > theID theName
    | > 19 Allen
    | > 20 Peter
    | > 21 Marry
    | > 44 Linda
    | > 444 Jerry
    | > 666 Tom
    | > 667 Jack
    | > 668 Steven
    | >
    | > 2. Drag and drop a ReportViewer control on the page. In design view,
    right
    | > click the control and select "Show Smart Tag". On the popup window
    click
    | > the "Design a new report". Follow the instructions provided by the
    wizard
    | > to link the report to the datatable.
    | >
    | > 3. Double click the created rdlc file in the solution explorer window
    to
    | > open it. In the properties window find the "ReportParameters" property,

    | > click the value field in this item and click the "¡­" button on the
    right
    | > side to open the "Report Properties" window.
    | >
    | > 4. Click the "Add" button on the left bottom side to add a new
    parameter to
    | > this report. Set the Name "theID" as the Name, "Integer" as Data Type
    and
    | > "theID" as Prompt. Uncheck the "Null" checkbox on the window to allow
    | > default value to this parameter. Then input "=20" in the textbox beside
    the
    | > checkbox. Click "OK" button.
    | >
    | > 5. In the design view of the rdlc file, select the "table1" Table,
    right
    | > click it and click "Properties" to open the "Table Properties" window.
    | > Select the "Filters" tab. Set "=Fields!theID.Value" as the Expression,
    "<"
    | > as the operator and "=Parameters!theID.Value" as the Value. Cllick "OK"
    | > button.
    | >
    | > 6. Shift to the design view of the page, right click the ReportViewer
    | > control, click "Show Smart Tab", choose the newly created rdlc file as
    the
    | > report.
    | >
    | > 7. Start debugging to test. If everything is normal we can only see the
    "19
    | > Allen" record in the report.
    | >
    | > 8. In the source view of the page, add following code:
    | >
    | > <asp:DropDownList ID="DropDownList3" runat="server"
    AutoPostBack="True"
    | > onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    | > <asp:ListItem Text="20" Value="20"></asp:ListItem>
    | > <asp:ListItem Text="500" Value="500"></asp:ListItem>
    | > <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    | > </asp:DropDownList>
    | > In the aspx.cs of the page, add following code:
    | > protected void DropDownList3_SelectedIndexChanged(object sender,
    EventArgs
    | > e)
    | > {
    | > Microsoft.Reporting.WebForms.ReportParameter[] p = new
    | > Microsoft.Reporting.WebForms.ReportParameter[1];
    | > p[0] = new
    Microsoft.Reporting.WebForms.ReportParameter("theID",
    | > this.DropDownList3.SelectedValue);
    | > this.ReportViewer1.LocalReport.SetParameters(p);
    | > }
    | >
    | > Here the "ReportViewer1" is the ID of the ReportViewer control.
    | >
    | > 9. Start debugging to test. When the selected item in the DropDownList
    get
    | > changed we'll see different records in the report.
    | >
    | > Please have a try and let me know if it works. If it's not what you
    need
    | > please clarify your requirement.
    | >
    | >
    | > Regards,
    | > Allen Chen
    | > Microsoft Online Support
    | >
    | > Delighting our customers is our #1 priority. We welcome your comments
    and
    | > suggestions about how we can improve the support we provide to you.
    Please
    | > feel free to let my manager know what you think of the level of service
    | > provided. You can send feedback directly to my manager at:
    | > .
    | >
    | > ==================================================
    | > Get notification to my posts through email? Please refer to
    | >
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
    | >
    | > Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    | > where an initial response from the community or a Microsoft Support
    | > Engineer within 2 business day is acceptable. Please note that each
    follow
    | > up response may take approximately 2 business days as the support
    | > professional working with you may need further investigation to reach
    the
    | > most efficient resolution. The offering is not appropriate for
    situations
    | > that require urgent, real-time or phone-based interactions. Issues of
    this
    | > nature are best handled working with a dedicated Microsoft Support
    Engineer
    | > by contacting Microsoft Customer Support Services (CSS) at
    | > http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    | > ==================================================
    | > This posting is provided "AS IS" with no warranties, and confers no
    rights.
    | >
    | > --------------------
    | > | Thread-Topic: ReportViewer - Add a dropdown or checkbox to the content
    | > | thread-index: Ack563il5nDFokv7RBe6ypk+Hx7X6Q==
    | > | X-WBNR-Posting-Host: 65.55.12.11
    | > | From: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ==?=
    | > <>
    | > | Subject: ReportViewer - Add a dropdown or checkbox to the content
    | > | Date: Wed, 29 Oct 2008 10:26:26 -0700
    | > | Lines: 15
    | > | Message-ID: <>
    | > | MIME-Version: 1.0
    | > | Content-Type: text/plain;
    | > | charset="Utf-8"
    | > | Content-Transfer-Encoding: 7bit
    | > | X-Newsreader: Microsoft CDO for Windows 2000
    | > | Content-Class: urn:content-classes:message
    | > | Importance: normal
    | > | Priority: normal
    | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | > | Path: TK2MSFTNGHUB02.phx.gbl
    | > | Xref: TK2MSFTNGHUB02.phx.gbl
    | > microsoft.public.dotnet.framework.aspnet:78886
    | > | NNTP-Posting-Host: tk2msftsbfm01.phx.gbl 10.40.244.148
    | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    | > |
    | > | I have a VS 2008 ASP.NET webform that has a reportview tag on it,
    | > accessing
    | > | an .RLDC report in local report.
    | > |
    | > | The columns for the report are essentially:
    | > |
    | > | Month Item #1 Item#2 Item#3
    | > |
    | > | I would like to add a checkbox or dropdown control to the .RLDC and
    have
    | > | Item #1, Item #2, or Item #3 display conditionally based on a
    checkbox
    | > being
    | > | clicked or a dropdown value being selected.
    | > |
    | > | Is there a way to do this?
    | > |
    | > |
    | > |
    | > |
    | >
    | >
    |
     
    Allen Chen [MSFT], Oct 31, 2008
    #4
  5. Hi,

    Do you have any further questions?

    Regards,
    Allen Chen
    Microsoft Online Support
    --------------------
    | Thread-Topic: ReportViewer - Add a dropdown or checkbox to the content
    | thread-index: Ack6sRZste9TyqVWQ+q8RDAKtCqVEQ==
    | X-WBNR-Posting-Host: 65.55.12.11
    | From: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ==?=
    <>
    | References: <>
    <Ki#>
    | Subject: RE: ReportViewer - Add a dropdown or checkbox to the content
    | Date: Thu, 30 Oct 2008 10:01:01 -0700
    | Lines: 173
    | Message-ID: <>
    | MIME-Version: 1.0
    | Content-Type: text/plain;
    | charset="Utf-8"
    | Content-Transfer-Encoding: 8bit
    | X-Newsreader: Microsoft CDO for Windows 2000
    | Content-Class: urn:content-classes:message
    | Importance: normal
    | Priority: normal
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Path: TK2MSFTNGHUB02.phx.gbl
    | Xref: TK2MSFTNGHUB02.phx.gbl
    microsoft.public.dotnet.framework.aspnet:78954
    | NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | Allen,
    |
    | On this step, you're adding the dropdown control to the page with the
    | reportviewer on it, so that it appears above or below the report itself.
    I
    | want the dropdown or checkbox list to appear in the report itself in the
    | header section. Is this possible?
    |
    | Ian
    |
    | > 8. In the source view of the page, add following code:
    | >
    | > <asp:DropDownList ID="DropDownList3" runat="server"
    AutoPostBack="True"
    | > onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    | > <asp:ListItem Text="20" Value="20"></asp:ListItem>
    | > <asp:ListItem Text="500" Value="500"></asp:ListItem>
    | > <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    | > </asp:DropDownList>
    |
    | "Allen Chen [MSFT]" wrote:
    |
    | > Hi,
    | >
    | > From your description you want to group or filter the data shown on the
    | > ReportViewer, right? If so I'd lilke to demonstrate how to do this step
    by
    | > step using a DropDownList on the page.
    | >
    | > 1. Prepare a test data table in your database. The data table has two
    | > columns:
    | > theID PK int
    | > theName nvarchar
    | >
    | > Insert arbitrary records into this table, such as:
    | >
    | > theID theName
    | > 19 Allen
    | > 20 Peter
    | > 21 Marry
    | > 44 Linda
    | > 444 Jerry
    | > 666 Tom
    | > 667 Jack
    | > 668 Steven
    | >
    | > 2. Drag and drop a ReportViewer control on the page. In design view,
    right
    | > click the control and select "Show Smart Tag". On the popup window
    click
    | > the "Design a new report". Follow the instructions provided by the
    wizard
    | > to link the report to the datatable.
    | >
    | > 3. Double click the created rdlc file in the solution explorer window
    to
    | > open it. In the properties window find the "ReportParameters" property,

    | > click the value field in this item and click the "¡­" button on the
    right
    | > side to open the "Report Properties" window.
    | >
    | > 4. Click the "Add" button on the left bottom side to add a new
    parameter to
    | > this report. Set the Name "theID" as the Name, "Integer" as Data Type
    and
    | > "theID" as Prompt. Uncheck the "Null" checkbox on the window to allow
    | > default value to this parameter. Then input "=20" in the textbox beside
    the
    | > checkbox. Click "OK" button.
    | >
    | > 5. In the design view of the rdlc file, select the "table1" Table,
    right
    | > click it and click "Properties" to open the "Table Properties" window.
    | > Select the "Filters" tab. Set "=Fields!theID.Value" as the Expression,
    "<"
    | > as the operator and "=Parameters!theID.Value" as the Value. Cllick "OK"
    | > button.
    | >
    | > 6. Shift to the design view of the page, right click the ReportViewer
    | > control, click "Show Smart Tab", choose the newly created rdlc file as
    the
    | > report.
    | >
    | > 7. Start debugging to test. If everything is normal we can only see the
    "19
    | > Allen" record in the report.
    | >
    | > 8. In the source view of the page, add following code:
    | >
    | > <asp:DropDownList ID="DropDownList3" runat="server"
    AutoPostBack="True"
    | > onselectedindexchanged="DropDownList3_SelectedIndexChanged">
    | > <asp:ListItem Text="20" Value="20"></asp:ListItem>
    | > <asp:ListItem Text="500" Value="500"></asp:ListItem>
    | > <asp:ListItem Text="1000" Value="1000"></asp:ListItem>
    | > </asp:DropDownList>
    | > In the aspx.cs of the page, add following code:
    | > protected void DropDownList3_SelectedIndexChanged(object sender,
    EventArgs
    | > e)
    | > {
    | > Microsoft.Reporting.WebForms.ReportParameter[] p = new
    | > Microsoft.Reporting.WebForms.ReportParameter[1];
    | > p[0] = new
    Microsoft.Reporting.WebForms.ReportParameter("theID",
    | > this.DropDownList3.SelectedValue);
    | > this.ReportViewer1.LocalReport.SetParameters(p);
    | > }
    | >
    | > Here the "ReportViewer1" is the ID of the ReportViewer control.
    | >
    | > 9. Start debugging to test. When the selected item in the DropDownList
    get
    | > changed we'll see different records in the report.
    | >
    | > Please have a try and let me know if it works. If it's not what you
    need
    | > please clarify your requirement.
    | >
    | >
    | > Regards,
    | > Allen Chen
    | > Microsoft Online Support
    | >
    | > Delighting our customers is our #1 priority. We welcome your comments
    and
    | > suggestions about how we can improve the support we provide to you.
    Please
    | > feel free to let my manager know what you think of the level of service
    | > provided. You can send feedback directly to my manager at:
    | > .
    | >
    | > ==================================================
    | > Get notification to my posts through email? Please refer to
    | >
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
    | >
    | > Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    | > where an initial response from the community or a Microsoft Support
    | > Engineer within 2 business day is acceptable. Please note that each
    follow
    | > up response may take approximately 2 business days as the support
    | > professional working with you may need further investigation to reach
    the
    | > most efficient resolution. The offering is not appropriate for
    situations
    | > that require urgent, real-time or phone-based interactions. Issues of
    this
    | > nature are best handled working with a dedicated Microsoft Support
    Engineer
    | > by contacting Microsoft Customer Support Services (CSS) at
    | > http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    | > ==================================================
    | > This posting is provided "AS IS" with no warranties, and confers no
    rights.
    | >
    | > --------------------
    | > | Thread-Topic: ReportViewer - Add a dropdown or checkbox to the content
    | > | thread-index: Ack563il5nDFokv7RBe6ypk+Hx7X6Q==
    | > | X-WBNR-Posting-Host: 65.55.12.11
    | > | From: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ==?=
    | > <>
    | > | Subject: ReportViewer - Add a dropdown or checkbox to the content
    | > | Date: Wed, 29 Oct 2008 10:26:26 -0700
    | > | Lines: 15
    | > | Message-ID: <>
    | > | MIME-Version: 1.0
    | > | Content-Type: text/plain;
    | > | charset="Utf-8"
    | > | Content-Transfer-Encoding: 7bit
    | > | X-Newsreader: Microsoft CDO for Windows 2000
    | > | Content-Class: urn:content-classes:message
    | > | Importance: normal
    | > | Priority: normal
    | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | > | Path: TK2MSFTNGHUB02.phx.gbl
    | > | Xref: TK2MSFTNGHUB02.phx.gbl
    | > microsoft.public.dotnet.framework.aspnet:78886
    | > | NNTP-Posting-Host: tk2msftsbfm01.phx.gbl 10.40.244.148
    | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    | > |
    | > | I have a VS 2008 ASP.NET webform that has a reportview tag on it,
    | > accessing
    | > | an .RLDC report in local report.
    | > |
    | > | The columns for the report are essentially:
    | > |
    | > | Month Item #1 Item#2 Item#3
    | > |
    | > | I would like to add a checkbox or dropdown control to the .RLDC and
    have
    | > | Item #1, Item #2, or Item #3 display conditionally based on a
    checkbox
    | > being
    | > | clicked or a dropdown value being selected.
    | > |
    | > | Is there a way to do this?
    | > |
    | > |
    | > |
    | > |
    | >
    | >
    |
     
    Allen Chen [MSFT], Nov 7, 2008
    #5
  6. the_kauboy Guest

    Hi Allen!

    Any way of using Check boxes & setting values on run-time?

    Cheers...
    the_kauboy
     
    the_kauboy, Nov 20, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S. Justin Gengo

    Re: dropdown overlaps reportviewer in IE

    S. Justin Gengo, Jul 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    481
    S. Justin Gengo
    Jul 31, 2004
  2. =?Utf-8?B?TmVvZHluYW1pYw==?=

    How to add barcode images into ASP.NET ReportViewer - RDLC reports

    =?Utf-8?B?TmVvZHluYW1pYw==?=, Nov 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,647
    Juan T. Llibre
    Nov 23, 2005
  3. hazz
    Replies:
    6
    Views:
    49,923
    SkyUCHC
    Jun 9, 2010
  4. Replies:
    0
    Views:
    435
  5. ns
    Replies:
    1
    Views:
    1,353
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 18, 2007
Loading...

Share This Page