For that you will have to use jQuery.
Check this sample
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type = "text/javascript">
$("[id*=TextBox2]").live("keyup", function () {
if (!isNaN($(this).val())) {
var row = $(this).closest("tr");
$("[id*=TextBox3]", row).val(parseInt($("[id*=TextBox1]", row).val()) * parseInt($("[id*=TextBox2]", row).val()));
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</form>
</body>
</html>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Item"), new DataColumn("Price"), new DataColumn("Total") });
dt.Rows.Add("Shirt", 200, 0);
dt.Rows.Add("Football", 30, 0);
dt.Rows.Add("Bat", 22.5, 0);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}