简体   繁体   中英

ASP.NET non-html escaped string to GridView

I have GridView with my DAO as data source rendering some person data (name, surname...). I want to add to rendered table simple link to expanded view with more informations. Ithought I could add html link with POST argument to each row. But every html I try to pass to GridView gets escaped. Can I somehow unescape it? Or is there any other simple way?

It is my private, very quick project, I don´t need any robust solution. Just the simplest and quickest one. Thanks.

It sounds like you want to use an ItemTemplate in your gridview to render HTML controls within the grid:

            asp:GridView ID="myGrid" runat="server">
                <Columns>
                    <asp:TemplateField HeaderText="Last Name">
                        <ItemTemplate>
                            <!--Any HTML can go here, below is a label -->
                            <label><%# DataBinder.Eval (Container.DataItem, "lastname") %><label>                        
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
             </asp:GridView>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM