Solved

Need syntax help building hyperlink

Posted on 2017-03-09
2
58 Views
Last Modified: 2017-03-09
I am having problems with syntax in this function.    It checks the value of every data item in the ItemTemplate of an ASP Repeater. If “_” is found it sets the whole line as a hyperlink, otherwise just displays the line. It is finding the “_” , displaying the text, but the hyperlink is not active.

<ItemTemplate>
        <tr>
            <td class="style14"> <%# CheckValue(DataBinder.Eval(Container.DataItem, "recaPrintScreen").ToString())%> </td>
        </tr>
    </ItemTemplate>

[aspx.vb page]
Public Function CheckValue(v As [String]) As [String]
   If (Left(v, 3)).Contains("_") Then
        Return "<asp:HyperLink " + "ID=HyperLinkCheckValue " + "target=_blank " + "runat=server " +
               " NavigateUrl=./foo.aspx?SearchNumber=" + strSearchNum + "&src=IOD" + "&cty=" + currentCounty + "&plead=" +
               _strPleadingType + "&type=" + strPleadingTypeDetail + "'>" + v + "</asp:HyperLink>"
    Else
       Return v
    End If
End Function
0
Comment
Question by:4ncid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 42041700
At that point I would just write out the HTML:
 
If (Left(v, 3)).Contains("_") Then
 Return "<a " + "ID='HyperLinkCheckValue' " + "target='_blank' "  + 
               " href='./foo.aspx?SearchNumber=" + strSearchNum + "&src=IOD" + "&cty=" + currentCounty + "&plead=" +
               _strPleadingType + "&type=" + strPleadingTypeDetail + "'>" + v + "</a>"


 Else
       Return v
    End If

Open in new window

0
 

Author Comment

by:4ncid
ID: 42041779
That works! Thanks much.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question