You are on page 1of 2

sEnqRefNo, sOurQuotRefNo, sCustName, OurQuotRefDate, sEnqRefDate, sRevision, sSlno, sDescription, sUnitOfMeasure, nQuantity, nBasicPrice, nMarginPa, nUnitRate, nEDAmount, nVatPa,

nVatAmount, nCSTPa, nCSTAmount, nUnitRateInclSply, nTotalAmtSply, nUnitPrice, nStaxPa, nStaxAmount, nUnitRateinclInst, nTotalAmountInst, sRemarks protected void txtEdpa_TextChanged(object sender, EventArgs e) { //Casting sender to Dropdown TextBox txt = sender as TextBox; //Looping through each Gridview row to find exact Row //of the Grid from where the SelectedIndex change event is fired. int rowIndex = 0; foreach (GridViewRow row in grdReport.Rows) { //Finding Dropdown control Control ctrl = row.FindControl("txtEdpa") as TextBox; if (ctrl != null) { TextBox ddl1 = (TextBox)ctrl; //Comparing ClientID of the dropdown with sender if (txt.ClientID == ddl1.ClientID) { TextBox txTURate = (TextBox)grdReport.Rows[rowIndex].Cells[8 ].FindControl("txTURate"); TextBox txtEdpa = (TextBox)grdReport.Rows[rowIndex].Cells[9] .FindControl("txtEdpa"); TextBox txtEdAmtt = (TextBox)grdReport.Rows[rowIndex].Cells[ 10].FindControl("txtEdAmtt"); double TuRate= Convert.ToDouble(txTURate.Text); double EDPa = Convert.ToDouble(txtEdpa.Text); double EDAmount = TuRate * EDPa / 100; txtEdAmtt.Text = EDAmount.ToString(); } } rowIndex = rowIndex + 1; } }

protected void txtVatpa_TextChanged(object sender, EventArgs e) { //Casting sender to Dropdown TextBox txt = sender as TextBox; //Looping through each Gridview row to find exact Row //of the Grid from where the SelectedIndex change event is fired. int rowIndex = 0; foreach (GridViewRow row in grdReport.Rows) { //Finding Dropdown control Control ctrl = row.FindControl("txtEdpa") as TextBox; if (ctrl != null) { TextBox ddl1 = (TextBox)ctrl; //Comparing ClientID of the dropdown with sender if (txt.ClientID == ddl1.ClientID) { TextBox txTURate = (TextBox)grdReport.Rows[rowIndex].Cells[8 ].FindControl("txTURate"); TextBox txtEdpa = (TextBox)grdReport.Rows[rowIndex].Cells[9] .FindControl("txtEdpa"); TextBox txtEdAmtt = (TextBox)grdReport.Rows[rowIndex].Cells[ 10].FindControl("txtEdAmtt"); double TuRate = Convert.ToDouble(txTURate.Text); double EDPa = Convert.ToDouble(txtEdpa.Text); double EDAmount = TuRate * EDPa / 100; txtEdAmtt.Text = EDAmount.ToString(); } } rowIndex = rowIndex + 1; } }

You might also like