How to remove table automatically generated from gridview in asp: TemplateField?

0

How to remove the automatically generated table from gridview in asp: TemplateField?

I'm using a gridview like this

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<ul>
<li><%#Eval("Nome") %></li>
</ul>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

But when I run and see the source code of the page, this result is displayed:

<table cellspacing="0" rules="all" border="1" id="GridView1" style="border-
collapse:collapse;">

<tr>
<td>
<ul>
<li>Nome do usuario/li>
</ul>
</td>
</tr>

But I want the result to look like this:

<ul>
<li>Nome do usuario</li>
</ul>

remembering that the language I'm using is VB.NET

    
asked by anonymous 18.12.2017 / 12:44

1 answer

0

I was able to solve the problem instead of using a GridView I used a DataList with the property RepeatLayout="Flow" that way my code looked like this:

<asp:DataList ID="tabeladobanco" runat="server" RepeatLayout="Flow">
<ItemTemplate>
<li><%#Eval("Nome") %></li>
</ItemTemplate>
</asp:DataList>

Source result:

<ul>
<li>Nome do usuario</li>
</ul>
    
19.12.2017 / 14:16