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

Fill grid programmatically?

5 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
FeRtoll
Top achievements
Rank 1
FeRtoll asked on 14 Apr 2010, 09:16 AM
How can i fill grid through vb.net (silverlight) code?

Something like:
mygrid.AddHeader("ID")
mygrid.AddHeader("Name")



Dim myrow as GridRow
myrow.addColumn("1")
myrow.addColumn("Marin")
mygrid.addRow(myrow)

Dim myrow2 as GridRow
myrow2.addColumn("1")
myrow2.addColumn("Tina")
mygrid.addRow(myrow2)

How to do that? Without using lists, datasets, adapters, linqs, references, bla bla bla...

Thanks

Dim myrow as GridRow
myrow.addColumn("1")
myrow.addColumn("Marin")
mygrid.addRow(myrow)

5 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 14 Apr 2010, 09:37 AM
Hi Marin Bartolić,

RadGridView was designed as databound control. This means anything displayed in  cells will come form the object set as ItemsSource.

Unfortunately  you can not add cells/rows columns the way you request . Looking at your requirements I guess an ordinary Silverlight Grid panel will be more suitable for your scenario.

In case you need some of the RadGridVIew-specific features, I am afraid you can not escape from coding atleast a simple ViewModel to serve as ItemsSource for the RadGridView.

Best wishes,
Pavel Pavlov
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
FeRtoll
Top achievements
Rank 1
answered on 14 Apr 2010, 10:30 AM
so if i want to add something to grid i first need to add in database and then read from database?

what if user dont want to save (goes cancel button on my form) then i have to find in database and delete?

or how?

how to create that viewmodel?
0
FeRtoll
Top achievements
Rank 1
answered on 14 Apr 2010, 11:07 PM
ummm do i have to post new thread to get answer quicker? :)
0
Accepted
Pavel Pavlov
Telerik team
answered on 15 Apr 2010, 12:14 PM
Hi FeRtoll,

Yo do not need a database at all , just a light View Model should do the work .
In other words - you can store your data in a Collection in the memory and Add /Remove Items from this collection .
I would recomend using an ObservableCollection . This will allow RadGridVIew to sensce any changes in the collection and update the UI automatically.

Kind regards,
Pavel Pavlov
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
FeRtoll
Top achievements
Rank 1
answered on 15 Apr 2010, 01:32 PM
yes ok thanks!

You could write some sample but nevermind! I got answer!
Tags
GridView
Asked by
FeRtoll
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
FeRtoll
Top achievements
Rank 1
Share this question
or