1

I want to modify the existing OrderID column in a report to be a hyperlink. So added the following <Action> code. But it's throwing the following error. Could someone please help with this. I'm fairly new on working with SSRS Reports. Thanks in Advance.

Error:

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 file code:

<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>
Jacobm001
  • 4,431
  • 4
  • 30
  • 51
ranp
  • 57
  • 2
  • 12
  • Don't forget to set EnableHyperlinks property of the report to true - https://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.localreport.enablehyperlinks.aspx – InitK Sep 14 '17 at 14:05

1 Answers1

2

My links look like this:

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

This may be your problem, as indicated by this line in the error:

List of possible elements expected: 'Style, ActionInfo, Top, ...

I personally like to limit direct editing of .rdl code as much as possible, and use the Design tab in Visual Studio to modify the file instead. I've found that changing the XML can be very error prone if the structure isn't perfect, so I save it as a last resort.

To fix the XML structure, you'll have to do something like this:

<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>

If you must edit the code directly, you will most likely find the report definition to be very useful, which is linked in the error. It links to this page which tells you the schema, i.e. the rules of how the RDL needs to be structured.

McGlothlin
  • 2,059
  • 1
  • 15
  • 28
  • Thanks @McGlothlin. But when clicked on the hyperlink, it is throwing the Server error. Error: Server Error in '/Reports' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Reports/QuickSearch.aspx But the same url worked in the other report. – ranp Sep 14 '17 at 16:49
  • Try again with the full URL, i.e. the absolute path to the resource. If that doesn't work, make sure you have your syntax correct. Check out this question which may help you explore possibilities: https://stackoverflow.com/questions/1597258/ssrs-relative-url-hyperlink – McGlothlin Sep 14 '17 at 16:53
  • Absolute path works. It's just the relative path having this error. old report was developed using ssrs2005 and this one was 2008. Do you think anything with calling javascript should change? – ranp Sep 14 '17 at 16:56
  • 2
    We (my team) use `javascript:void(window.open(' .... '))` which opens a new tab. However if the absolute path works, I suspect the issue lies with the way you're referencing the relative path, which is slightly out of scope of the original question you asked. – McGlothlin Sep 14 '17 at 17:00
  • 1
    Thank you. Will try to research more on this and post a different question if necessary. Appreciate your help. – ranp Sep 14 '17 at 17:07