protected void grvProperty_RowUpdating(object sender, GridViewUpdateEventArgs e) { DBHander.Property property = new DBHander.Property(); property.Description = (grvProperty.Rows[e.RowIndex].FindControl("TextBox2") as TextBox).Text; property.Prize = Convert.ToDecimal((grvProperty.Rows[e.RowIndex].FindControl("TextBox3") as TextBox).Text); property.Room = Convert.ToInt32((grvProperty.Rows[e.RowIndex].FindControl("TextBox4") as TextBox).Text); property.TypeId = Convert.ToInt32((grvProperty.Rows[e.RowIndex].FindControl("DropDownList2") as DropDownList).SelectedValue); property.PropertyId = Convert.ToInt32(grvProperty.DataKeys[e.RowIndex].Value); _propertyDal.Update(property); grvProperty.EditIndex = -1; RefreshData(); }
protected void grvProperty_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Add New")) { DBHander.Property property = new DBHander.Property(); property.UserId = (grvProperty.FooterRow.FindControl("addname") as TextBox).Text; property.Description = (grvProperty.FooterRow.FindControl("Description") as TextBox).Text; property.Prize = Convert.ToDecimal((grvProperty.FooterRow.FindControl("Prize") as TextBox).Text); property.Room = Convert.ToInt32((grvProperty.FooterRow.FindControl("Room") as TextBox).Text); property.TypeId = Convert.ToInt32((grvProperty.FooterRow.FindControl("DropDownList1") as DropDownList).SelectedValue); property.AddressId = 3; _propertyDal.Add(property); RefreshData(); } }