コード例 #1
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            DataGridItem item = default(DataGridItem);

            for (int i = 0; i < grdBrands.Items.Count; i++)
            {
                item = grdBrands.Items[i];
                if (item.ItemType == ListItemType.AlternatingItem | item.ItemType == ListItemType.Item)
                {
                    if (((CheckBox)item.FindControl("ChkSelect")).Checked)
                    {
                        string strId = item.Cells[1].Text;
                        ApartmentService.ApartmentInfo_Delete(strId);
                    }
                }
            }
            grdBrands.CurrentPageIndex = 0;
            BindGrid();
        }
コード例 #2
0
        protected void grdBrands_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            string strCA = e.CommandArgument.ToString();

            switch (e.CommandName)
            {
            case "Edit":
                Insert = false;
                Id     = strCA;
                List <ApartmentInfo> listApartmentInfos = ApartmentService.ApartmentInfo_GetById(Id);
                //txtName.Text = listE[0].Name;
                //txtLogo.Text = listE[0].Logo;
                //imgLogo.ImageUrl = listE[0].Logo.Length > 0 ? listE[0].Logo : "";
                //txtOrd.Text = listE[0].Ord;
                pnView.Visible   = false;
                pnUpdate.Visible = true;
                break;

            case "Delete":
                ApartmentService.ApartmentInfo_Delete(strCA);
                BindGrid();
                break;
            }
        }