您可以设置使用报表查看器控件内部参数? [英] Can you set an Internal parameter using the Report Viewer control?

查看:417
本文介绍了您可以设置使用报表查看器控件内部参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使用报表查看器控件中设置一个内部的参数值?

  rv.ServerReport.SetParameters(新ReportParameter [] {新ReportParameter(用户名,User.Identity.Name)});


  

{报表参数用户名是只读的,不能修改。
  (rsReadOnlyReportParameter)}


我听说你只能设置使用报表查看器的内部参数...但它似乎是一个内部参数就是这样...内部。需要明确的是,在服务器端的内部参数是其中两个隐藏提示不检查的参数定义。如果隐藏检查(隐藏参数),参数仍然可以通过查询字符串或订阅传递。


解决方案

MSDN - 创建报表参数和设置报表参数属性


  

隐藏和内部参数


  
  

您可以设置在公布控制参数可见性选项
  报告。设置隐藏和内部选择提供不同
  能见度的水平。你可以隐藏参数的参数
  公布的报告输入区域,但为它设置值的报表
  URL或订阅定义。 如果您的参数设置
  内部,它不以任何方式暴露除了在报告
  定义
。内部参数必须有一​​个缺省值,它可以
  为空,如果空值选项已被选择的允许。



更新,有点测试后:

这实际上是一个令人困惑的定义。该参数暴露报表查看器和值可以在报表属性很容易地覆盖和链接报表的属性。

您仍无法设置为从URL或从其他报表中的钻取操作中的内部参数的值。当您创建的动作,但是当你试图向下钻取你的错误是明显的:报表参数'名'是只读的,不能修改我。不想像你将能够要么修改从code中的价值,但我还没有测试过。

Is it possible to set an internal parameter value using the Report Viewer control?

rv.ServerReport.SetParameters(new ReportParameter[] { new ReportParameter("Username", User.Identity.Name) });

{"The report parameter 'Username' is read-only and cannot be modified. (rsReadOnlyReportParameter)"}

I've heard that you can only set an internal parameter using the Report Viewer...but it seems an internal parameter is just that...internal. To be clear, an internal parameter on the server side is one where both Hide and Prompt are not checked on the parameter definition. If Hide is checked (hidden parameter), the parameter can still be passed in via a query string or on a subscription.

解决方案

MSDN - Creating Report Parameters and Setting Report Parameter Properties:

Hidden and Internal Parameters

You can set options that control parameter visibility in the published report. Setting the Hidden and Internal options provides different levels of visibility. You can hide the parameter on the parameter input area of the published report, yet set values for it on a report URL or in a subscription definition. If you set a parameter to Internal, it is not exposed in any way except in the report definition. An internal parameter must have a default value, which can be null if the Allow null value option has been selected.


Update, after a bit of testing:

This is actually a confusing definition. The parameter is exposed in Report Viewer and the value can be easily overridden in the report properties and the properties of a linked report.

You are still unable to set the value of an internal parameter from the URL or from the drill-down action from another report. It is visible when you create the action but when you try to drill-down you get the error: The report parameter 'name' is read-only and cannot be modified. I wouldn't imagine you will be able to modify the value from code either, but I haven't tested that.

这篇关于您可以设置使用报表查看器控件内部参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆