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

Changing value of inserted row

1 Answer 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
timtom
Top achievements
Rank 1
timtom asked on 19 Aug 2008, 12:40 PM
Hi :o)

How do I change the value of a column/field that has been inserted using the automatic add new row functionality of the grid?

Many thanks

Tim 

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 21 Aug 2008, 12:27 PM
Hello Tim,

You can use the CellEndEdit event of RadGridView for implementing this behavior:

void radGridView1_CellEndEdit(object sender, GridViewCellEventArgs e) 
    if (this.radGridView1.CurrentRow is GridViewNewRowInfo && (e.ColumnIndex == 3 || e.ColumnIndex == 4))  
    { 
        GridViewNewRowInfo newRowInfo = (GridViewNewRowInfo)this.radGridView1.CurrentRow; 
        newRowInfo.DataRowInfo.Cells["Total"].Value = newRowInfo.DataRowInfo.Cells["Num"].Value * newRowInfo.DataRowInfo.Cells["Price"].Value; 
    } 

Don't hesitate to contact us if you have other questions.

Greetings,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
timtom
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or