如何将超链接添加到.rdl文件中的列

时间:2017-09-13 17:36:08

标签: reporting-services ssrs-2008 rdlc ssrs-tablix rdl

我想将报表中的现有OrderID列修改为超链接。所以添加了以下<Action>代码。但它抛出了以下错误。有人可以帮忙解决这个问题。我在处理SSRS报告时相当新。 在此先感谢。

错误

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;amp;searchValue=" &amp; Fields!OrderId.Value &amp; "'"</Hyperlink>
                 </Action>
                </Textbox>
               </CellContents>
              </TablixCell>
       .....</TablixBody>
       ....
</ReportItems>
</Body>

1 个答案:

答案 0 :(得分:2)

我的链接看起来像这样:

<ActionInfo>
  <Actions>
    <Action>
      <Hyperlink> [link goes here] </Hyperlink>
    </Action>
  <Actions>
<ActionInfo>

这可能是您的问题,如错误中的这一行所示:

  

预期可能元素列表:'Style, ActionInfo ,Top,...

我个人希望尽可能限制直接编辑.rdl代码,并使用Visual Studio中的“设计”选项卡来修改文件。我发现如果结构不完美,更改XML可能非常容易出错,因此我将其保存为最后的手段。

要修复XML结构,您必须执行以下操作:

<Textbox Name="orderID">
  <ActionInfo>
    <Actions>
      <Action>
        <Hyperlink>="javascript:window.location='QuickSearch.aspx?searchType=1&amp;amp;searchValue=" &amp; Fields!OrderId.Value &amp; "'"</Hyperlink>
      </Action>
    <Actions>
  <ActionInfo>
</Textbox>

如果您必须直接编辑代码,您很可能会发现报告定义非常有用,并在错误中链接。它链接到this页面,它告诉您架构,即RDL需要如何构建的规则。