zoukankan      html  css  js  c++  java
  • ASP.NET获取<EmptyDataTemplate></EmptyDataTemplate>模板中的textBox控件值

    前台

    <EmptyDataTemplate>
                        <table>
                            <tr style="color: Black; background-color: SkyBlue; font-weight: bold;">
                                <th scope="col" style=" 10px;">
                                    &nbsp;
                                </th>
                                <th scope="col" style=" 190px;">
                                    名称
                                </th>
                                <th scope="col" style=" 194px;">
                                    键值
                                </th>
                                <th>
                                    &nbsp;
                                </th>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtName" runat="server" MaxLength="100" CssClass="input_text"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtCode" runat="server" MaxLength="16" CssClass="input_text"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:LinkButton ID="linkBtnInsert" runat="server" CommandName="Add">新增</asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>

    后台

    /// <summary>
        /// GridView事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvFieldValue_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Add"))
            {
                GridViewRow row = (GridViewRow)((e.CommandSource as LinkButton).NamingContainer);//获取值
                string txtName = (row.FindControl("txtName") as TextBox).Text;
                string txtCode = (row.FindControl("txtCode") as TextBox).Text;

             }

         }

  • 相关阅读:
    关于EasyUI datagrid 无法在dialog中显示的问题分析及解决方案!
    WPF 矩形框8个控制点伸缩及拖拽
    Socket异步通信及心跳包同时响应逻辑分析(最后附Demo)。
    C#断点续传下载。
    C# 全屏坐标及区域坐标获取。自定义光标及系统光标描边捕捉显示。
    解决项目无法添加VBIDE问题
    python爬虫-入门-了解爬虫
    字符串输入数字
    面试题3--数组中的重复数字(new数组的新写法)
    等号操作符重载为什么不能用友元函数大揭秘,以及函数没有等到重载的时候赋值会出现什么现象(盲点)
  • 原文地址:https://www.cnblogs.com/wuhuisheng/p/1997745.html
Copyright © 2011-2022 走看看