Click here to Skip to main content
15,904,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to change price of amount at run time
for example

Amount=Rate*Qty suppose answer is 25
but at run time i want to change amount 25 to 26 please help me what should i do? beacuse price is in dollar
my code is given below
C#
private void dgDetail_CellEndEdit(object sender, DataGridViewCellEventArgs e)
      {



          if (dgDetail.CurrentRow != null)
          {
              if (dgDetail.CurrentRow.Cells["Qty"].Value != null && dgDetail.CurrentRow.Cells["Rate"].Value != null)
              {
                  if (dgDetail.CurrentRow.Cells["Qty"].Value != null && dgDetail.CurrentRow.Cells["Qty"].Value.ToString().Trim() != "" && Convert.ToDecimal(dgDetail.CurrentRow.Cells["Qty"].Value) > 0)
                  {
                      decimal GAmount = Convert.ToDecimal(dgDetail.CurrentRow.Cells["Rate"].Value.ToString()) * Convert.ToDecimal(dgDetail.CurrentRow.Cells["Qty"].Value.ToString());
                      dgDetail.CurrentRow.Cells["Amount"].Value = Convert.ToDecimal(GAmount);


                       if (dgDetail.CurrentRow.Cells["STPercent"].Value != null)
                          {
                              dgDetail.CurrentRow.Cells["SaleTax"].Value = GAmount / 100 * Convert.ToDecimal(dgDetail.CurrentRow.Cells["STPercent"].Value.ToString());




                              if (dgDetail.CurrentRow.Cells["OtherSTP"].Value != null)
                              {
                                  dgDetail.CurrentRow.Cells["OtherST"].Value = GAmount / 100 * Convert.ToDecimal(dgDetail.CurrentRow.Cells["OtherSTP"].Value.ToString());

                                  dgDetail.CurrentRow.Cells["Total"].Value = GAmount + Convert.ToDecimal(dgDetail.CurrentRow.Cells["SaleTax"].Value.ToString()) + Convert.ToDecimal(dgDetail.CurrentRow.Cells["OtherST"].Value.ToString());
                              }
                          }
                      }

                      //}


                  }


              }


        // }
      }
Posted
Comments
Karthik_Mahalingam 15-Jan-14 8:01am    
y u want to change form 25 to 26 ??
Tahir Mahmood From karachi 15-Jan-14 8:05am    
beacuse price is in dollar the requirement of client is that i want to change price that i want so thats why i am askilng how will i change value in cell in datagrid
Karthik_Mahalingam 15-Jan-14 8:06am    
you need the $ symbol also ??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900