简体   繁体   English

SSRS报表中的超链接表达式可将参数传递给ASP.NET应用

[英]Hyperlink expression in SSRS Report to pass parameter to ASP.NET app

I have a basic SSRS report and I would like to be able to click on an item on my report to go to one of my asp.net pages (one intended for updating records) and I'd like to pass in the primary key to the asp page, so that on pageload it gets passed to a stored proc on page load and can populate text boxes and dropdown menus accordingly. 我有一个基本的SSRS报告,我希望能够单击报告上的某个项目以转到我的asp.net页之一(一个用于更新记录的页),我想将主键传递给asp页面,以便在页面加载时将其传递给页面加载时存储的proc,并可以相应地填充文本框和下拉菜单。 I'm just unsure of how to structure the expression for the hyperlink in the report designer in order to do so. 我只是不确定如何在报表设计器中构造超链接的表达式。 Maybe through a query string? 也许通过查询字符串?

  • How do I structure the hyperlink expression in SSRS? 如何在SSRS中构造超链接表达式?
  • How do I accept the parameter in the c# codebehind on Page_Load to use in SQL Query? 如何接受Page_Load上c#代码后面的参数以在SQL查询中使用?

Thank you for any help in illuminating this for me. 感谢您为我提供的帮助。 I've tried my own research on seemingly a ton of sources but none are overly clear to me. 我已经尝试了很多方面的研究,但对我来说还不清楚。

Edit: Including an attempt to try and illustrate what I'm trying to do. 编辑:包括尝试尝试说明我正在尝试做的事情。

For the hyperlink expression in SSRS, I'm attempting with 对于SSRS中的超链接表达式,我正在尝试

="http://10.155.54.101/Update?CurrencyId="+Fields!CurrencyId.Value

Which generates the following error: [rsRuntimeErrorInExpression] the Hyperlink expression for the textbox 'Model' contains an error: Input string was not in a correct format. 它将生成以下错误:[rsRuntimeErrorInExpression]文本框“模型”的超链接表达式包含错误:输入字符串的格式不正确。 Which is strange because I've seen that format in other sources be referenced as correct. 这很奇怪,因为我已经看到其他来源中的格式被称为正确格式。 Eg. 例如。 http://www.advancedssrs.com/2014/01/how-can-i-use-dynamic-hyperlinks.html http://www.advancedssrs.com/2014/01/how-can-i-use-dynamic-hyperlinks.html

But either way, my c# codebehind for receiving the paramater (which I haven't been able to test yet) is as follows 但是无论哪种方式,我用于接收参数(我尚未能够测试)的c#代码背后如下

if (Request.QueryString != null){
int CurrencyId = int.Parse(Request.QueryString["CurrencyId"]);
//Additional logic here
}

Am I roughly on the right track? 我大概在正确的轨道上吗?

The value in the hyperlink needs to be a string. 超链接中的值必须为字符串。 Convert the value using Cstr() 使用Cstr()转换值

="http://10.155.54.101/Update?CurrencyId=" & Cstr(Fields!CurrencyId.Value)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM