?
Solved

Need syntax help building hyperlink

Posted on 2017-03-09
2
Medium Priority
?
82 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
2 Comments
 
LVL 41

Accepted Solution

by:
Kyle Abrahams earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

862 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