rowcommand事件中获取控件

时间:2022-11-19 07:13:06

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

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();
                }

}