如何通过onClick按钮调用该函数

时间:2016-09-02 10:45:55

标签: c# html asp.net

protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt = DataAccess.getWithdrawList();

            StringBuilder html = new StringBuilder();

            html.Append("<div class='row mt'>");
            html.Append("<div class='col-md-12'>");
            html.Append("<div class='content-panel'>");
            html.Append("<table class='table table-striped table-advance table-hover'>");
            html.Append("<h4><i class='fa'></i>Withdrawal List</h4>");
            html.Append("<hr>");
            html.Append("<thead>");
            html.Append("<tr>");

            foreach (DataColumn column in dt.Columns)
            {
                html.Append("<th><i class='fa'></i>");
                html.Append(column.ColumnName);
                html.Append("</th>");
            }

            html.Append("</tr>");
            html.Append("</thead>");
            html.Append("<tbody>");

            foreach (DataRow row in dt.Rows)
            {
                html.Append("<tr>");
                foreach (DataColumn column in dt.Columns)
                {
                    html.Append("<td runat='server'>");
                    html.Append(row[column.ColumnName]);
                    html.Append("</td>");
                }
                html.Append("<td><button class='btn btn-success btn-xs'><i class='fa fa-check'></i></button></td>");
                html.Append("</tr>");
            }

            html.Append("</tbody>");
            html.Append("</table>");
            html.Append("</div>");
            html.Append("</div>");
            html.Append("</div>");

            PlaceHolder1.Controls.Add(new Literal { Text = html.ToString() });
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {

        }

我想点击按钮来调用btnSubmit函数,并将数据列的每一行中的数据从HTML表格检索到后端代码,但我没有这样做,因为我无法通过按钮点击asp来调用该函数.net,有人有想法吗?谢谢。

0 个答案:

没有答案