Click here to Skip to main content
12,749,465 members (32,313 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET

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 11-Feb-13 19:25pm
vinodkumarnie 12-Feb-13 1:09am
Can you share your source code..?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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)

            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.


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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170215.1 | Last Updated 18 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100