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

Exception on BeginInsert

4 Answers 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Helly
Top achievements
Rank 1
Helly asked on 07 Sep 2010, 04:17 PM
I have a RadGridView, that is programmably populated with items.
Like this:

public void BindData()

 

 

{

radGridView.Columns.Clear();

 

 

if ((SystemLookUpModel)DataContext == null) return;

 

 

 

GridViewDataColumn gc = new GridViewDataColumn();

 

gc.Header = 

 

"Option";

 

 

gc.UniqueName = 

 

"Name";

 

 

gc.DataMemberBinding = 

 

new Binding("Name");

 

 

radGridView.Columns.Add(gc);

 

 

foreach (SystemLookUp slu in ((SystemLookUpModel)DataContext).ProgramType.SystemLookUp)

 

 

{

 

 

NumericUpDownColumn gc2 = new NumericUpDownColumn();

 

 

gc2.Header = slu.Name;

gc2.UniqueName = 

 

string.Format("ProgramID{0}", slu.ID);

 

 

gc2.DataMemberBinding = 

 

new Binding(gc2.UniqueName);

 

 

radGridView.Columns.Add(gc2);

}

LoadRows();

 

 

}

private void LoadRows()

 

 

{

 

 

IList list = (IList)((SystemLookUpModel)DataContext).GetServiceInProgramsDataSource();

 

 

radGridView.ItemsSource = list;

radGridView.SelectedItem = list.Count == 0 ?

 

null : list[0];

 

 

}

 

I am adding rows with button add like this:

private void btnAdd_Click(object sender, RoutedEventArgs e)

 

 

{

radGridView.BeginInsert();

}

 

The problem: sometimes, only when grid got focus, but not the first time, when I press Add button, I got the Exception:
Specified argument was out of the range of valid values. Parameter name: index
It is thrown 2 times, one after another. The new row created and selected, but it does not enter the edit mode. If I manually double-click it it works OK.
Can you help me with this problem?

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 08 Sep 2010, 09:14 AM
Hi Helly,

I would need a bit more specifics about your application. What exactly is inside the SystemLookUpModel? What is the funcionality of the GetServiceInProgramsDataSource() method ? How are you defining your xaml file ? It would be great if your could provide some code-snippets or a sample project.
 

Kind regards,
Maya
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
Helly
Top achievements
Rank 1
answered on 08 Sep 2010, 10:57 AM
Hi, Maya

I've created a sample project with this problem, but it seems I can't upload it to this thread.
So I attached it to a a support ticket # 346202
Hope, you wiil receive it and help to fix the problem.
0
Accepted
Maya
Telerik team
answered on 08 Sep 2010, 01:35 PM
Hello Helly,

We did have a bug on Clearing of the Columns but it has already been fixed. So, all you need to do is to upgrade to our latest version that you can download from your Telerik Account.
 

Greetings,
Maya
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
Helly
Top achievements
Rank 1
answered on 14 Sep 2010, 05:13 PM
Thank you.
We download the newer version and exception is gone.
Tags
GridView
Asked by
Helly
Top achievements
Rank 1
Answers by
Maya
Telerik team
Helly
Top achievements
Rank 1
Share this question
or