Click here to Skip to main content
15,908,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i have Prepared one Datagrid for Updating Products Price and Update all in one shot,
for that i have taken Textbox Control inside Datagrid,

My data Looks like this...

ItemName , PurchaseRate , SaleRate , PurchaseRateWithvat , SaleRateWithVat

I have Enter PurchaseRateWithVat from That it's calculate PurchaseRateWithoutVat and after Changing all the Price Update in Database in One Shot.

but Main Problem is that when i change the value of textbox and tring to retrive changed value then it returns oldValue+newvalue like (0.00,80) here 0.00 is old and 80 is updated value,

i need only updated value,

please help me,
Thanks in Advance.
Posted
Comments
vinodkumarnie 12-Feb-13 1:09am    
Can you share your source code..?

1 solution

Hi All,

I assume that you have implemented the IDataGridViewEditingControl to host the Textbox inside the DataGridView control. so in that case you might have also derived the TextBox control as well.

You just need to override On TextChanged event and parse the text. it will give you updated vlaue.

Please refer the below code block.

protected override void OnTextChanged(EventArgs e)
       {
           base.OnTextChanged(e);

           DataGridViewColumn dataGridViewColumn = this.dataGridView.Columns[this.dataGridView.CurrentCell.ColumnIndex];
           ISwitchRowStatement swtRowStatement = this.dataGridView["ColRow", this.dataGridView.CurrentCell.RowIndex].Tag as ISwitchRowStatement;

           float value;
          if (float.TryParse(this.Text, out value))
           {

               this.dataGridView["ColumnHystersis", this.dataGridView.CurrentCell.RowIndex].Value = value;

           }
       }


Please post the code if above solution is not working for you.

Regards,
Sathish
 
Share this answer
 

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