Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 11-Feb-13 19:25pm
Comments
vinodkumarnie at 12-Feb-13 1:09am
   
Can you share your source code..?

1 solution

Rate this: bad
good
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)
        {
            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
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 340
1 OriginalGriff 250
2 DamithSL 170
3 Kornfeld Eliyahu Peter 130
4 Peter Leow 95
0 OriginalGriff 7,315
1 DamithSL 5,199
2 Sergey Alexandrovich Kryukov 4,917
3 Maciej Los 4,866
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 18 Feb 2013
Copyright © CodeProject, 1999-2014
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