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

Add rows manually

10 Answers 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Phillip Hamlyn
Top achievements
Rank 1
Phillip Hamlyn asked on 09 Nov 2009, 05:18 PM
Hi,

I am hand-crafting my GridView completely in the code-behind and cannot bind the Grid - so i need to add the rows manually and not set the ItemsSource Property. Can you please guide me the best way of manually adding a row to the grid. I have tried using the BeginInsert() method - however i get a NullException error if i do not set the ItemsSource prior to invoking BeginInsert().

Would it be possible to provide me some sample code to achieve the desired results

Thanks
 
 

10 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 10 Nov 2009, 07:35 AM
Hello Phillip Hamlyn,

Currently RadGridView does not support unbound mode but this capability is on our to-do list and we will try to introduce it with Q3 2009 SP1. You could workaround the problem by binding the grid to an empty ObservableCollection and adding items to that collection instead.

In regard to the BeginInsert exception we have logged this issue and it will be fixed as soon as possible and the fix will also be included in our upcoming service pack.


Regards,
Milan
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.
0
Phillip Hamlyn
Top achievements
Rank 1
answered on 10 Nov 2009, 08:40 AM
Thank you for your prompt response.
 
Just out of curiousty, do you have a tentative date for Q3 SP1
0
Vlad
Telerik team
answered on 10 Nov 2009, 08:52 AM
Hello Phillip,

Our first service pack will be first week of December however we will upload our latest internal build every Friday.

All the best,
Vlad
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.
0
Alfa
Top achievements
Rank 1
answered on 10 Nov 2009, 11:59 AM
Hi,

Can you provide any example for binding the grid to an empty ObservableCollection and adding items to that collection instead?
I checked your example on demo site/ Various Data Sources, there you have used
case "ObservableCollection":
{
        this.radGridViewDataBinding.ItemsSource = ExamplesDB.GetCustomers();
this.radGridViewDataBinding.Columns[0].IsVisible = false;
this.radGridViewDataBinding.ReorderColumns(2, 3);
break;
}

Where is the ObservableCollection?

Rgds
Alfa.
0
Accepted
Milan
Telerik team
answered on 10 Nov 2009, 01:21 PM
Hi Alfa,

Here is a sample project that demonstrate the approach that I have suggested.

Hope this helps.


All the best,
Milan
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.
0
Brian
Top achievements
Rank 1
answered on 23 May 2011, 10:14 PM
Is this functionality available in the current release (2011.1.315.1040) ??  We are trying to figure out how to accomplish this but can't seem to figure it out.
Tks.
0
Milan
Telerik team
answered on 24 May 2011, 09:43 AM

Hello Phillip Hamlyn,

Unbound mode is has been supported for many months now. May I ask you to take a look at this online demo which demonstrates how this mode works. 



Greetings,
Milan
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
Matthew
Top achievements
Rank 1
answered on 06 Dec 2011, 02:22 PM
Does the Silverlight RadGridView control support unbound mode yet?  If so, can you provide an example?

I was hoping to use RadGridView to provide an "Excel" like speadsheed.  This speadsheet would have a sheet worth of empty cells.  The cell would then populate with non-empty contents upon a user event.

Thanks In Advance,

Matt
0
Vlad
Telerik team
answered on 06 Dec 2011, 02:25 PM
Hi,

Have you checked the demo from the previous reply? You can check also these demos for more info about how to create dynamic data for the grid:

http://demos.telerik.com/silverlight/#GridView/UIVirtualization
http://demos.telerik.com/silverlight/#GridView/DataSources

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matthew
Top achievements
Rank 1
answered on 06 Dec 2011, 04:08 PM
Hi Vlad,

Thank you for your response.  I have indeed looked at the demos. The UIVirtualization demo is somewhat helpful.  I have tried to recreate this project from the example code and I am have some issues with Example.xaml

a.  Can't find: xmlns:behavior="clr-namespace:Telerik.Windows.Examples.GridView" 
b.  behavior:MyColumnsBindingBehavior.Columns="{Binding Columns, Source={StaticResource model}}"

As far as (a.), do I need the .dll to make this work?  I'd like to reproduce this functionality so that I have a good starting point.

I understand the basic premise of these unbound data examples. My main goal is to initially present a RadDataGrid with 10 rows and 10 columns that contain no text.  In Telerik WinForms, you would accomplish this by doing something like:

http://www.telerik.com/help/winforms/gridview-populating-with-data-unbound-mode.html

this.radGridView1.RowCount = 10;
this.radGridView1.Columns.Add(new GridViewTextBoxColumn("A"));
this.radGridView1.Columns.Add(new GridViewTextBoxColumn("B"));
this.radGridView1.MasterTemplate.AllowAddNewRow = false;

In essence, I'd like to create an empty 10x10 grid with the Silverlight controls.  Is this only possible by adding/binding to a class that essentially contains a 10x10 array of String.Empty?  Is there a better way to do this?

Thanks,
Matt



Tags
GridView
Asked by
Phillip Hamlyn
Top achievements
Rank 1
Answers by
Milan
Telerik team
Phillip Hamlyn
Top achievements
Rank 1
Vlad
Telerik team
Alfa
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Share this question
or