ASP.net VB.net wrap butto link in table cell

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

      I am trying to build an html button for an email where the button is wrapped in a table cell using the following code. It isn't working properly as shown in the attached image

      Dim oLinkAccept As String = "http://SteelYard.azurewebsites.net/offers_to_me?oOfferID=" & oNewOfferID & "&oOfferAcceptDecline=Accept"

            oHBody = oHBody & TableCellWrapper("<a href=" & oLinkAccept & " style='padding: 8px 12px; border: 1px solid #006400;border-radius: 2px;font-family: Helvetica, Arial, sans - serif;font-size:   14px; color: #006400;text-decoration: none;font-weight:bold;display: inline-block;' >ACCEPT</a>")

    Function TableCellWrapper(ByVal X As String) As String

        Dim S As String

        S = "<table width = '100%' cellspacing='0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td>"
        S &= S & "<table cellspacing = '0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td style = 'border-radius: 2px;' bgcolor='#ED2939'>"
        '<a  Class=”link” href="https://www.copernica.com" target="_blank">
        'Click            
        '</a>
        S &= S & X
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"



        TableCellWrapper = S

    End Function

Image1.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try with this:

Function TableCellWrapper(ByVal X As String) As String

        Dim S As String


  S = "<table width = '100%' cellspacing='0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td>"
        S &= S & "<table cellspacing = '0' cellpadding='0'>"
        S &= S & "<tr>"
        S &= S & "<td style ='border-radius: 2px;background-color:#ED2939;padding:5px'>"

        S &= S & X
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"
        S &= S & "</td>"
        S &= S & "</tr>"
        S &= S & "</table>"



        TableCellWrapper = S

    End Function

Open in new window

Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks but that doesn't work. It causes the buttons to repeat as shown in the image. So nothing has changed
Image1.jpg
You must have a result similar to the attached image. Verify.
20190913_212213.jpg
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Murray BrownASP.net/VSTO Developer

Author

Commented:
No I am looking for just one button
I simulated a table of several rows. Simulate a single row the result is like the attached image. I would have to see the complete code to see why you get another result.
20190913_215555.jpg
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial