按钮 onclick 不会转到 c# 中的事件 button_click

问题描述

所以我目前正在尝试使用内部图像的文本框,并且我有方法 onclick 在 c# 中输入我的 button_clink 事件,但它不起作用

<div class="input-container">
    <input type="text" id="txtSearch" runat="server" class="input-field" style="color: black;" placeholder="Pesquisar.."/>
    <button id="btnsearch" class="wrapper" OnClick="btnsearch_Click" runat="server"><i class="fas fa-search" style="color:#8b9095;" ></i></button>
</div>

c# 代码

protected void btnsearch_Click(object sender,EventArgs e)
{
    con.open();
    var txtSearch = FindControl("txtSearch") as TextBox;
    sqlCommand cmd = new sqlCommand("select disTINCT from [encomenda] where No_= " + txtSearch + "",con);

    sqlDataReader sdr = cmd.ExecuteReader();

    if (sdr.Read())
    {
        sqlDataAdapter sda = new sqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        sda.Fill(dt);
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }

    con.Close();
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)