0
我在困惑中怎麼辦,有沒有辦法?如何將以下事件轉換爲javascript?
以下是我的代碼。有沒有可能的方法來調用JavaScript中的方法,因爲我在事件中有一個名爲GetTaxDetails()
的方法。
protected void ddlTaxCode_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
decimal taxvalue = 0;
decimal rate = 0;
if (txtRate.Text != "")
{
rate = Convert.ToDecimal(txtRate.Text);
}
string Taxcode = ddlTaxCode.SelectedValue.ToString();
DataSet dsTaxDetails = new DataSet();
objTax.TXCode = Taxcode;
dsTaxDetails = objTax.GetTaxDetails();
txtCalcType.Text = dsTaxDetails.Tables[0].Rows[0][4].ToString();
decimal IncludeValue = Convert.ToDecimal(dsTaxDetails.Tables[0].Rows[0][3].ToString());
string Calculation = Session["TaxCalcType"].ToString();
if (Calculation == "Exclude")
{
txtValue.Text = IncludeValue.ToString();
if (txtCalcType.Text == "P-Perc")
{
taxvalue = IncludeValue * (rate/100);
}
else
{
taxvalue = IncludeValue;
}
txtTaxValue.Text = taxvalue.ToString();
txtItemRate.Text = (taxvalue + rate).ToString();
}
else
{
decimal IncludedTaxValue = (100 + IncludeValue)/100;
txtValue.Text = IncludedTaxValue.ToString();
if (txtCalcType.Text == "P-Perc")
{
taxvalue = rate - (rate/IncludedTaxValue);
}
else
{
taxvalue = IncludeValue;
}
txtTaxValue.Text = taxvalue.ToString();
txtItemRate.Text = (rate - taxvalue).ToString();
}
}
catch (Exception)
{
Response.Redirect("Error.aspx");
}
}
您可以使用ajax調用。 –
k讓我試試。謝謝 – Maes