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

Data Bound Item

2 Answers 252 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mihai Velicu
Top achievements
Rank 1
Mihai Velicu asked on 01 Apr 2010, 11:32 PM
Hi !
I have a grid with some columns.
If I double click a cell I want to open a window chose some values and update the cell value. Is working fine for rows already in the table.
For new rows "Click here to add new row " is not working.
 I've seen something strange.

I have this code
Dim currentRow As GridViewRowInfo = CType(sender, RadGridView).CurrentRow
if currentRow.DataBoundItem Is Nothing
     do something

But even if I seen in watch screen this as having nothing value
the "do something" line is not executed .It jumps over it. Is like is a value there, even I see in watch window this currentRow.DataBoundItem = nothing.

Why is that ?
How I can access the current NEW line and modify cell values through code ?

Regards,
Mihai



2 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 07 Apr 2010, 09:20 AM
Hi Mihai Velicu,

In the current edition of RadGridView the new row has a related data row and in order to change its values, you can use the following code snippet:

If TypeOf Me.radGridView1.CurrentRow Is GridViewNewRowInfo Then
    Dim editRow As GridViewRowInfo = DirectCast(Me.radGridView1.CurrentRow, GridViewNewRowInfo).DataRowInfo
    editRow.Cells("Test").Value = 1
End If

In Q1 2010 SP1 release this behavior will be handled internally and you will be able to directly edit values of the new row as in your code snippet. Q1 2010 SP1 will be released by the end of the current week.

All the best,
Julian Benkov
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.
0
Jamie
Top achievements
Rank 1
answered on 31 Aug 2011, 11:13 PM
  
Tags
GridView
Asked by
Mihai Velicu
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Jamie
Top achievements
Rank 1
Share this question
or