This is a migrated thread and some comments may be shown as answers.

[Solved] CellValueChanged Event does not return changed value

1 Answer 731 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aivan Monceller
Top achievements
Rank 1
Aivan Monceller asked on 24 Apr 2010, 02:55 PM

The previous value of the column is 3000 then after I changed it to 3 then CellValueChanged is fired but then the string quantity does not return 3 but instead 3000. I will be using the new value to update the record on the database.

        private void radGridView1_CellValueChanged(object sender, Telerik.WinControls.UI.CurrentRowChangedEventArgs e) 
        { 
            String quantity = radGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); 
            String dbidx = radGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); 
            String itemcode = radGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); 
            var query = (from p in db.TB_ITEMs 
                         where p.ITEM_DBIDX == Convert.ToInt32(dbidx) 
                         select p).Single(); 
            query.ITEM_DURABILITY = Convert.ToInt32(quantity); 
            if (!String.IsNullOrEmpty(itemcode)) 
                query.ITEM_IDX = Convert.ToInt32(itemcode); 
            db.SubmitChanges(); 
        } 


The datasource comes from a result of a LINQ query, I need to update at database level using this event. If I am not using the right event please direct me to the right event. This event fires up after editing the field and clicking outside the field BUT it does not return the new value but the old value. Please tell me if you need more information, this is kind of urgent.

After clicking outside the cell the value reverts to the old value hence the CellValueChanged event gets the old value. What should I do to commit the new value to the Grid Row and to retrieve the new value for database updating?

Language: C#
Telerik Version: 2010.1.10.308
.NET: 3.5

Need Help,
Aivan


1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 29 Apr 2010, 08:56 AM
Hello Aivan Monceller,

The CellValueChanged event is fired when the cell's value has been changed. You can read more about value changing events in this documentation article.

I didn't manage to reproduce your issue. Could you send me a sample project where the issue is present? It will also be helpful if you give us more information on how you create and initialize the grid. Are you canceling the value changing event?

A bit off topic, please ask the person who has purchased our controls in your company to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: www.telerik.com/account/faqs.aspx.

 
Greetings,
Svett
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Aivan Monceller
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or