lina fetisova
Top achievements
Rank 1
lina fetisova
asked on 26 May 2010, 07:31 AM
Good day!
I have a class names Sales:
I bind this a List of items of this class to a RadGridView:
grid.ItemSource = e.Result;
where e.Result is a List<Sales>.
For column "Name" I make it this way:
How can I make it for ICollection<ActivityCategory> categories to show it in my RadGridView (maybe with a list of text separated by commas or with an dynamic number of chek boxes with text)?
I have a class names Sales:
public class Sales : BaseDomain<br> |
{<br> |
public virtual string Name { get; set; }<br> |
ICollection<ActivityCategory> categories = new |
List<ActivityCategory>();<br> |
} |
I bind this a List of items of this class to a RadGridView:
grid.ItemSource = e.Result;
where e.Result is a List<Sales>.
For column "Name" I make it this way:
<telerikGridView:GridViewDataColumn UniqueName="Name" Header="Name |
of Sale" />. |
How can I make it for ICollection<ActivityCategory> categories to show it in my RadGridView (maybe with a list of text separated by commas or with an dynamic number of chek boxes with text)?
8 Answers, 1 is accepted
0
Hello,
You can check my answer in your other forum post.
All the best,
Vlad
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.
You can check my answer in your other forum post.
All the best,
Vlad
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
lina fetisova
Top achievements
Rank 1
answered on 26 May 2010, 07:43 AM
Vlad, thank you very much, but can you provide me a more detailed answer, please?
0
Hi lina fetisova,
To display a collection of values within a single cell , you will need to place an ItemsControl in the cell. Maybe a ListBox will do fine.
To place the ListBox you will need to use the CellTemplate property of the column.
It would be something like :
Alternatively you may represent the collection as a comma-separated list. For this you will need to use an IValueConverter in the DataMemberBinding of the column. Within the Convert method of the IValueConverter you will need to turn the collection into a comma -separated string.
In case you have troubles implementing one of these approaches do not hesitate to contact me.
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.
To display a collection of values within a single cell , you will need to place an ItemsControl in the cell. Maybe a ListBox will do fine.
To place the ListBox you will need to use the CellTemplate property of the column.
It would be something like :
<
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
ListBox
ItemsSource
=
"{Binding categories}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
Alternatively you may represent the collection as a comma-separated list. For this you will need to use an IValueConverter in the DataMemberBinding of the column. Within the Convert method of the IValueConverter you will need to turn the collection into a comma -separated string.
In case you have troubles implementing one of these approaches do not hesitate to contact me.
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
lina fetisova
Top achievements
Rank 1
answered on 26 May 2010, 08:53 AM
thank you very much!
I write
and see a result:
a list of strings: "CAP.Registrator.ActivityCategory"
CAP.Registrator.ActivityCategory has a property Name.
How can I see exactly this property?
I write
<
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
ListBox
ItemsSource
=
"{Binding
ActivityCategories}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
and see a result:
a list of strings: "CAP.Registrator.ActivityCategory"
CAP.Registrator.ActivityCategory has a property Name.
How can I see exactly this property?
0
Hello,
You can define desired ItemTemplate for this ListBox.
Greetings,
Vlad
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.
You can define desired ItemTemplate for this ListBox.
Greetings,
Vlad
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
lina fetisova
Top achievements
Rank 1
answered on 26 May 2010, 09:13 AM
oh! thank you very much, Vlad, Pavel !=)
everything is ok now!
<telerikGridView:GridViewDataColumn>
<telerikGridView:GridViewDataColumn.CellTemplate>
<DataTemplate>
<ListBox ItemsSource ="{Binding ActivityCategories}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="txtAttributeName" Text="{Binding Name}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</telerikGridView:GridViewDataColumn.CellTemplate>
</telerikGridView:GridViewDataColumn>
thank you very much!=) you are a wonderful team! =)
everything is ok now!
<telerikGridView:GridViewDataColumn>
<telerikGridView:GridViewDataColumn.CellTemplate>
<DataTemplate>
<ListBox ItemsSource ="{Binding ActivityCategories}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="txtAttributeName" Text="{Binding Name}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</telerikGridView:GridViewDataColumn.CellTemplate>
</telerikGridView:GridViewDataColumn>
thank you very much!=) you are a wonderful team! =)
0
lina fetisova
Top achievements
Rank 1
answered on 26 May 2010, 09:23 AM
Oh, I have enother question:
how can I make sorting of grid with this column and enable filters for this column?
there are no filter and sorting by clicking the header of this column now
how can I make sorting of grid with this column and enable filters for this column?
there are no filter and sorting by clicking the header of this column now
0
Hi lina fetisova,
I believe you may find this discussion helpful.
All the best,
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.
I believe you may find this discussion helpful.
All the best,
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.