Greetings,
I am currently working on a project that involves calculating values from two textboxes within a gridview and displaying the result in a third textbox using JavaScript. The calculation should occur as soon as a value is entered into the second textbox.
The textboxes in question are Quantity and Price, with the desired result being displayed in Total.
To achieve this, I have attempted the following approach:
protected void gvPOItms__RowCreated(Object sender, GridViewRowEventArgs e)
{
try
{
TextBox txt1 = (TextBox)e.Row.FindControl("txtQty");
TextBox txt2 = (TextBox)e.Row.FindControl("txtRate");
TextBox txt3 = (TextBox)e.Row.FindControl("txtValue");
txt1.Attributes["onKeyup"] = "javascript: return multiplication('" + txt1.ClientID + "','" + txt2.ClientID + "','" + txt3.ClientID + "')";
txt2.Attributes["onKeyup"] = "javascript: return multiplication('" + txt1.ClientID + "','" + txt2.ClientID + "','" + txt3.ClientID + "')";
}
catch (Exception ex)
{
Response.Write(ex);
}
}
In the provided JavaScript function, the logic for the multiplication of the input values is expected to be executed, resulting in the calculated total displayed in the designated third textbox.
Despite implementing the aforementioned code snippets, I am encountering difficulties in obtaining the desired outcome without any error prompts.
If anyone can provide insight into what may be causing this issue, I would greatly appreciate it.