예제 #1
0
 private void BindGrid()
 {
     grdBrands.DataSource = HomesService.Homes_GetByAll();
     grdBrands.DataBind();
     if (grdBrands.PageCount <= 1)
     {
         grdBrands.PagerStyle.Visible = false;
     }
     else
     {
         grdBrands.PagerStyle.Visible = true;
     }
 }
예제 #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 <HomeInfo> listE         = HomeService.HomeInfo_GetById(Id);
                List <Homes>    listViewHomes = HomesService.Homes_GetByAll();
                txtHomeName.Text             = listE[0].Name;
                txtRealEstateOwnersName.Text = listViewHomes[0].RealEstateOwnersName;
                ddlHomeType.Text             = listViewHomes[0].HomeTypeName;
                ddlTransactionType.Text      = listViewHomes[0].TransactionType;
                EdtDescription.Text          = listE[0].Description;
                txtAddress.Text       = listE[0].Address;
                txtPrice.Text         = listE[0].Price;
                txtTotalArea.Text     = listE[0].TotalArea;
                txtHomeArea.Text      = listE[0].HomeArea;
                txtGargenArea.Text    = listE[0].GargenArea;
                ddlBedroomNumber.Text = listE[0].BedroomNumber;
                ddlTierNumber.Text    = listE[0].TierNumber;
                //txtImage0.Text = listE[0].Image1;
                txtImage1.Text = listE[0].Image2;
                txtImage2.Text = listE[0].Image3;
                txtImage3.Text = listE[0].Image4;
                txtImage4.Text = listE[0].Image5;
                txtImage5.Text = listE[0].Image6;

                //imgLogo.ImageUrl = listE[0].Logo.Length > 0 ? listE[0].Logo : "";
                //pnView.Visible = false;
                //pnUpdate.Visible = true;
                break;

            case "Delete":
                HomeService.HomeInfo_Delete(strCA);
                BindGrid();
                break;
            }
        }