如何将超链接添加到.rdl文件中的列
我想修改报告中现有的OrderID列作为超链接。因此添加了以下代码<Action>
。但它抛出以下错误。有人可以帮助这一点。我在使用SSRS报告方面相当新。 在此先感谢。如何将超链接添加到.rdl文件中的列
错误:
Unhandled Exception: System.Web.Services.Protocols.SoapException:
System.Web.Services.Protocols.SoapException: The report definition is
not valid. Details: The element 'Textbox' in namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'
has invalid child element 'Action' in namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'.
List of possible elements expected: 'Style, ActionInfo, Top, Left,
Height, Width, ZIndex, Visibility, ToolTip, DocumentMapLabel,
Bookmark, RepeatWith, CustomProperties, Paragraphs, CanGrow,
CanShrink, HideDuplicates, ToggleImage, UserSort, KeepTogether,
DataElementName, DataElementOutput, DataElementStyle' in namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'
as well as any element in namespace '##other'. at
Microsoft.ReportingServices.WebServer.ReportingService2005Impl.CreateReport(String
Report, String Parent, Boolean Overwrite, Byte[] Definition,
Property[] Properties, Warning[]& Warnings) at
Microsoft.ReportingServices.WebServer.ReportingService2005.CreateReport(String
Report, String Parent, Boolean Overwrite, Byte[] Definition,
Property[] Properties, Warning[]& Warnings) at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) at
Microsoft.SqlServer.ReportingServices2005.ReportingService2005.CreateReport(String
Report, String Parent, Boolean Overwrite, Byte[] Definition,
Property[] Properties) at
RdlSync.Repository.RemoteRdlRepository.AddRdl(IRdlFile file) at
RdlSync.Controller.RdlReconciler.Sync(Boolean commit, Boolean useMd5,
Boolean force) at RdlSync.Program.Main(String[] args)
.rdl文件代码:
<Body>
<ReportItems>
<Rectangle Name="RectMain">
<ReportItems>
<Tablix Name="tblMainReport">
<TablixBody>
<TablixCell>
<CellContents>
<Textbox Name="orderID">
<Action>
<Hyperlink>="javascript:window.location='QuickSearch.aspx?searchType=1&amp;searchValue=" & Fields!OrderId.Value & "'"</Hyperlink>
</Action>
</Textbox>
</CellContents>
</TablixCell>
.....</TablixBody>
....
</ReportItems>
</Body>
我的链接看起来是这样的:
<ActionInfo>
<Actions>
<Action>
<Hyperlink> [link goes here] </Hyperlink>
</Action>
<Actions>
<ActionInfo>
这可能是你的问题,指示通过这条线在错误:
List of possible elements expected: 'Style, ActionInfo, Top, ...
我个人很喜欢限制.rdl
代码直接编辑尽可能,并使用设计选项卡在Visual Studio中修改文件来代替。我发现如果结构不完美,更改XML可能非常容易出错,所以我把它作为最后的手段保存下来。
要解决XML结构,你必须做这样的事情:
<Textbox Name="orderID">
<ActionInfo>
<Actions>
<Action>
<Hyperlink>="javascript:window.location='QuickSearch.aspx?searchType=1&amp;searchValue=" & Fields!OrderId.Value & "'"</Hyperlink>
</Action>
<Actions>
<ActionInfo>
</Textbox>
如果必须直接编辑代码,你很可能会发现报表定义是非常有用的,这是链接的错误。它链接到this页面,该页面告诉您模式,即RDL如何构建的规则。
感谢@McGlothlin。但是当点击超链接时,它会抛出服务器错误。 错误: '/ Reports'应用程序中的服务器错误。 无法找到该资源。 描述:HTTP 404.您正在查找的资源(或其某个依赖项)可能已被删除,名称已更改或暂时不可用。请检查以下网址并确保它拼写正确。 请求的网址:/Reports/QuickSearch.aspx 但是相同的网址在其他报告中工作。 – ranp
请尝试使用完整网址,即资源的绝对路径。如果这不起作用,请确保您的语法正确。看看这个问题,这可能会帮助你探索可能性:https://stackoverflow.com/questions/1597258/ssrs-relative-url-hyperlink – McGlothlin
绝对路径的作品。这只是具有此错误的相对路径。旧报告是使用ssrs2005开发的,而这个是2008年。你认为任何与调用javascript应该改变? – ranp
不要忘了该报告的EnableHyperlinks属性设置为true - https://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.localreport.enablehyperlinks.aspx – InitK