protected void btnUseSellPrice_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtQuantity.Text)) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Message", "alert('Please enter Quantity');", true); } else { //if (string.IsNullOrEmpty(txtCurrentPrice.Text)) //{ // ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Message", "alert('Please enter Rate');", true); //} //else { DataSet ds = new DataSet(); string txtPurchaseCurrentDate = Convert.ToString(DateTime.Now); string price; ds = portfolioBo.GetGoldPrice(DateTime.Parse(txtPurchaseCurrentDate)); price = ds.Tables[0].Rows[0][0].ToString(); txtCurrentValue.Text = (Math.Round((double.Parse(price) * double.Parse(txtQuantity.Text)), 4)).ToString(); txtCurrentPrice.Text = price; } } }