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

Programmatically writing value in Cell upon Adding New Row

2 Answers 186 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tariq
Top achievements
Rank 1
Tariq asked on 29 Dec 2008, 03:25 PM
I am new to RadGrid for WinForm, and have some basic questions:

1.    Upon adding a new row to the grid, I want to write the value in code in one of the 10 cells. I tried by writing this code in the RowChanged event but did not work:  radGridView1.CurrentRow.Cells["WeekNumber"].Value = radSpin1.Value;
How I can achieve this.

2.    I don't want to use spinbutton Editor with a Decimal type column. Please let me know how to change the default Column Editor of a Decimal Type column?

Tariq Changgez

2 Answers, 1 is accepted

Sort by
0
Tariq
Top achievements
Rank 1
answered on 30 Dec 2008, 10:14 AM
I have figured out myself that by using the DefaultValuesNeeded event I can write value into any cell. Therefore I don't need a reply on this topic.

However I still need an answer to the second part of my original question i.e. how to use the TexBoxEditor with a Decimal type column.

Tariq
0
Victor
Telerik team
answered on 30 Dec 2008, 02:53 PM
Hello Tariq,

Thank you for the questions.
First I would advise you to take a look at our online documentation. Here is the link to the RadGridView:
http://www.telerik.com/help/winforms/grid_overview.html

To your first question:
I'm glad you were able to quickly find a solution on your own.
I was going to suggest that you do this:

Create a new row like this:
GridViewRowInfo rowInfo = this.radGridView1.Rows.AddNew(); 
Now you are free to edit the row cells. In your case for example:
info.Cells["WeekNumber"].Value = radSpin1.Value;  

To your second question:
Just change the Column type to GridViewTextBoxColumn and you will have a text box editor. It should work fine with numeric values.

Kind regards,
Victor
the Telerik team

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