rowcommand事件中获取控件

 //根据当前按钮生成命名空间

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {

                GridViewRow row = (GridViewRow)((e.CommandSource as ImageButton).NamingContainer);
                string menu_name = (row.FindControl("txtEmptyName") as TextBox).Text.Trim();
                string menu_description = (row.FindControl("txtEmptyDesc") as TextBox).Text.Trim();
                string menu_url = (row.FindControl("txtEmptyURL") as TextBox).Text.Trim();
                if (MenuBusiness.AddMenu(menu_name, menu_description, menu_url, login_user.UserId) > 0)
                {
                    this.Alert("successfuly!");
                    BindMenuList();
                }

}

原文地址:https://www.cnblogs.com/lxboy2009/p/5776627.html