private void btnSave_Click(object sender, RoutedEventArgs e) { decimal qty = 0; try { qty = decimal.Parse(txtQty.Text); cr.BulkUpdateQuantity(homeid, pagidstring, qty.ToString(), usercode); this.parent.SearchExistingProducts(); if (this.parent.allcheckbox != null) { this.parent.allcheckbox.IsChecked = false; } this.Close(); } catch (Exception ex) { MessageBox.Show("Please enter a valid quantity!"); } }