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

ReportViewer - Add a dropdown or checkbox to the content

P: n/a
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 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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_SelectedInde xChanged">
<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("theI D",
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#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/subs.../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==?=
<ch*********@community.nospam>
| Subject: ReportViewer - Add a dropdown or checkbox to the content
| Date: Wed, 29 Oct 2008 10:26:26 -0700
| Lines: 15
| Message-ID: <4B**********************************@microsoft.co m>
| 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 '08 #2

P: n/a
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_SelectedInde xChanged">
<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_SelectedInde xChanged">
<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("theI D",
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#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/subs.../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==?=
<ch*********@community.nospam>
| Subject: ReportViewer - Add a dropdown or checkbox to the content
| Date: Wed, 29 Oct 2008 10:26:26 -0700
| Lines: 15
| Message-ID: <4B**********************************@microsoft.co m>
| 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 '08 #3

P: n/a
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==?=
<ch*********@community.nospam>
| References: <4B**********************************@microsoft.co m>
<Ki*************@TK2MSFTNGHUB02.phx.gbl>
| Subject: RE: ReportViewer - Add a dropdown or checkbox to the content
| Date: Thu, 30 Oct 2008 10:01:01 -0700
| Lines: 173
| Message-ID: <53**********************************@microsoft.co m>
| 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_SelectedInde xChanged">
| <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_SelectedInde xChanged">
| <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("theI D",
| 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:
| ms****@microsoft.com.
| >
| ==================================================
| Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subs...#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/subs.../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==?=
| <ch*********@community.nospam>
| | Subject: ReportViewer - Add a dropdown or checkbox to the content
| | Date: Wed, 29 Oct 2008 10:26:26 -0700
| | Lines: 15
| | Message-ID: <4B**********************************@microsoft.co m>
| | 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 31 '08 #4

P: n/a
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==?=
<ch*********@community.nospam>
| References: <4B**********************************@microsoft.co m>
<Ki*************@TK2MSFTNGHUB02.phx.gbl>
| Subject: RE: ReportViewer - Add a dropdown or checkbox to the content
| Date: Thu, 30 Oct 2008 10:01:01 -0700
| Lines: 173
| Message-ID: <53**********************************@microsoft.co m>
| 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_SelectedInde xChanged">
| <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_SelectedInde xChanged">
| <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("theI D",
| 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:
| ms****@microsoft.com.
| >
| ==================================================
| Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subs...#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/subs.../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==?=
| <ch*********@community.nospam>
| | Subject: ReportViewer - Add a dropdown or checkbox to the content
| | Date: Wed, 29 Oct 2008 10:26:26 -0700
| | Lines: 15
| | Message-ID: <4B**********************************@microsoft.co m>
| | 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?
| |
| |
| |
| |
| >
| >
|

Nov 7 '08 #5

P: n/a
Hi Allen!

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

Cheers...
the_kauboy
Nov 20 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.