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

DataBound GridView problem in displaying dynamically added rows

2 Answers 164 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anil kumar
Top achievements
Rank 1
Anil kumar asked on 19 Jan 2010, 02:54 PM
Hi,

I am using a data bound gridview in which im using BindingList which is bound to grid and this grid is Hierarchical with 2 levels.
Im dynamically adding rows to 1st level of grid by clicking on button out side grid and it is working fine, here im adding row to the datasource but not to the grid.

but when i try to add row to 2nd level of grid, in the begining it works fine.
when i add 2nd record to 1st level, and if i insert 2nd level rows it keeps adding empty rows to grid.

so my problem is i want to add row dynamically outside grid as well as update and delete in same manner.

can any one help me ..plz

2 Answers, 1 is accepted

Sort by
0
Anil kumar
Top achievements
Rank 1
answered on 20 Jan 2010, 11:49 AM
Hi,

Adding up to the previous post, i have found that the viewtemplate of added row is throwing null reference exception and gridviewinfo is set to null.
at

at Telerik.WinControls.UI.GridViewRowInfo.get_ViewTemplate()



So can 1 help me where exactly im going wrong.
0
Julian Benkov
Telerik team
answered on 21 Jan 2010, 12:42 PM
Hello Anil kumar,

Please try expanding your hierarchy rows before adding child rows to it. You can use IsExpanded property of GridViewRowInfo. After inserting in the second level you can call the Update() method of GridViewTemplate with the action HierarchyChanged to rebuild the hierarchical data. 

If you continue to experience problems, please send us a code snippet to review your scenario.

Kind regards,

Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Anil kumar
Top achievements
Rank 1
Answers by
Anil kumar
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or