0

I need to create <a> tag via WebGrid but it is not visible. Although it is under the output html.

How to fix it and make it visible?

HTML code:

   @grid.GetHtml(
                            tableStyle: "grid",
                            headerStyle: "head",
                            alternatingRowStyle: "alt",
                            rowStyle: "row",
                            selectedRowStyle: "selected-row",
                            columns: grid.Columns(

                                             grid.Column("ReceiptURL", "Receipt", format: (item) => @Html.Raw(string.Format("<a target='_blank' class='' href='{0}'></a>" ,@item.ReceiptURL)), style: "")
                                    )
                                )
                            }

and HTML output:

 <tr class="row">
             <td><a target='_blank' class='' href='http://localhost:51381/Receipt/2bc1c02d-44a3-4a53-9255-98aa4a41cd53'></a></td>
        </tr>

So <a> is invisible. :(

Any clue?

NoWar
  • 36,338
  • 80
  • 323
  • 498

2 Answers2

1

it won't be visible it doesn't have a particular style (as @Travis said), and also your <a> is empty, I mean there is nothing between the opening <a> and the closing </a>, that's why don't see anything, try to put some text inside you'll probably see it

ppetrov
  • 3,077
  • 2
  • 15
  • 27
0

Give it some base minimum styling? Here is a simple example of an empty anchor tag.

demo: http://jsfiddle.net/v6S5m/1

markup:

<a 
  href="http://www.google.com"
  style="display:inline-block;min-height: 10px; min-width:20px;background-color:blue;"
</a>
Travis J
  • 81,153
  • 41
  • 202
  • 273
  • Hi! I put your style but no joy. :( – NoWar Jan 30 '13 at 00:44
  • @Peretz - Did the style get applied? If you were to use that markup, and then in the helper still call `style=""` it will override the definition. Alternatively, you may wish to use a conditional statement in there to provide some actual data or notice that the link is not present. – Travis J Jan 30 '13 at 00:49