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

RadGridView CreateRow event doesn´t fire always

3 Answers 205 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 18 Feb 2009, 09:57 AM
Hello,

I have strange problem with RadGridView.I am programatically binding data from strongly typed DataSet.The data bound to the RadGridView depends on what has user clicked in main menu.Everything works fine except the CreateRow event fires only when two from several tables from DataSet are bound to the control.I am not able to find any reason for that.Could You please give me some help?

RowsChanged event works fine.


3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 18 Feb 2009, 12:20 PM
Hello Jan,

Thank you for this question.

The CreateRow event is fired when RadGridView creates a new visual element. The header row is the first row in grid that is created. This happens when the EndInit method inside the Designer.cs file is called. My suggestion is that you subscribe to this event after the EndInit method is called.

You can do that using the property grid at design time or before setting the data source. I will be able to give more concrete suggestions if you send us the source code of your application.

Do not hesitate to contact us if you need further assistance.

Regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jan
Top achievements
Rank 1
answered on 18 Feb 2009, 12:41 PM
Hello Jack,

Thank You for Your quick response.

I am not sure, whether CreateRow event can be used for adding new rows.You can find my part of my code here http://tpm.fsv.cvut.cz/updates/telerik.zip .It is working only for dsCodeList.WheelKind and dsCodeList.CodeList as I expect.The RadGridView doesnt fire this event for other tables - see DataBind method.
I added CodeListRadGridView_CreateRow through designer as You suggested.
Any help would be appreciated.

Thank You Jan
0
Accepted
Jack
Telerik team
answered on 18 Feb 2009, 01:18 PM
Hello Jan,

The CreateRow event is fired only when creating new visual elements. RadGridView uses virtualization to optimize the memory usage and it contains visual elements only for the rows that are visible on screen.

Maybe a more suitable event would be the DefaultValuesNeeded event. It is fired every time when a new row is added and its cell values need to be initialized.

The event above is fired before any data is entered in the new row. To track the newly added data rows check the following KB article.

I hope this helps. Should you have any additional questions, feel free to ask.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Jan
Top achievements
Rank 1
Answers by
Jack
Telerik team
Jan
Top achievements
Rank 1
Share this question
or