Solved

Need syntax help building hyperlink

Posted on 2017-03-09
2
41 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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 …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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