首页 > 解决方案 > to html from c# method

问题描述

good afternoon, I want to call from html a method that is in c #

<div>
    <div id="divLista row-fluid">
                
            <table id="tblLista" cellpadding="0" cellspacing="0" border="0" class="table table-hover table-bordered">
                <thead>
                    <tr>
                        
                        <th>Nº</th>
                        <th>Fecha</th>
                        <th>Doc</th>                          
                        <th>Imprimir</th>
                    </tr>
                </thead>
                <tbody>
                    <%
                        if (xItems != null)
                            foreach (var item in xItems)
                            {
                                Response.Write("<tr class='data-row'>");                                   
                                Response.Write("<td>" + item.Id + "</td>");
                                Response.Write("<td>" + item.Fecha.ToShortDateString() + "</td>");
                                Response.Write("<td>" + item.Nro + "</td>");                                  
                                **Response.Write("<td><asp:Button id='btnEdit' class='btn btn-round btn-info btn-xs' runat='server' onserver='btnEdit_ServerClick(" + item +  ")') >Imprimir</asp:Button></td>");**
                                Response.Write("</tr>");
                            }
                    %>
                </tbody>
            </table>
        </div>
    </div>

</div>

C#

protected void btnEdit_ServerClick(object sender, EventArgs e)
{
    MostrarError("afasdfsdf");
}

标签: c#htmlasp.net

解决方案


推荐阅读