Hi,
We are using Telerik.Web.UI.dll version - 2009.3.1314.20 with visual studio 2008.
Currently our radgrid displays as below. No. of Factories are fixed and Factory names are known before the grid is configured as usual. Since we know the no. of factories and factory names (i.e. column names of the grid) well before we are using a simple DTO structure, a class with the following 5 properties and binding to the radgrid respectively - ItemName, Fac1, Fac2, Fac3, Fac4.
But recently we have comeup with a new requirement that there will be a factory added on a regular basis, may be one factory per month / 2 months and we don't want to modify the code everytime when a factory is added. In this case, how can we modify the radgrid to meet this requirment ? Assuming that "Factory 5" is added next month and the output should be displayed as below.
So we don't know the no. of columns and column names during design time. I think single level DTO structure will not be sufficient. Can we use a two level DTO as below ? If yes, how can we bind a two level DTO to a grid ? How can we mention the "datafield" name while configuring a grid column using the two level DTO ?
Or can we add properties (factorynames) to a class dynamically in .NET 3.5 ?
Do we have any demo samples on this kind of behaviour ?
Any help on this is very much appreciated.
We are using Telerik.Web.UI.dll version - 2009.3.1314.20 with visual studio 2008.
Currently our radgrid displays as below. No. of Factories are fixed and Factory names are known before the grid is configured as usual. Since we know the no. of factories and factory names (i.e. column names of the grid) well before we are using a simple DTO structure, a class with the following 5 properties and binding to the radgrid respectively - ItemName, Fac1, Fac2, Fac3, Fac4.
Item Name | Factory 1 | Factory 2 | Factory 3 | Factory 4 | |||
Item 1 | 12 | 13 | 14 | 15 | |||
Item 2 | 22 | 23 | 24 | 25 | |||
Item 3 | 32 | 33 | 34 | 35 |
But recently we have comeup with a new requirement that there will be a factory added on a regular basis, may be one factory per month / 2 months and we don't want to modify the code everytime when a factory is added. In this case, how can we modify the radgrid to meet this requirment ? Assuming that "Factory 5" is added next month and the output should be displayed as below.
Item Name | Factory 1 | Factory 2 | Factory 3 | Factory 4 | Factory 5 | ||||
Item 1 | 12 | 13 | 14 | 15 | 16 | ||||
Item 2 | 22 | 23 | 24 | 25 | 26 | ||||
Item 3 | 32 | 33 | 34 | 35 | 36 |
So we don't know the no. of columns and column names during design time. I think single level DTO structure will not be sufficient. Can we use a two level DTO as below ? If yes, how can we bind a two level DTO to a grid ? How can we mention the "datafield" name while configuring a grid column using the two level DTO ?
Or can we add properties (factorynames) to a class dynamically in .NET 3.5 ?
Do we have any demo samples on this kind of behaviour ?
Any help on this is very much appreciated.
public
class
ItemFactoryDTO
{
[DataMember]
public
long
ItemId
{
get
;
set
; }
[DataMember]
public
long
ItemName
{
get
;
set
; }
[DataMember]
public
ICollection<FactoryQuantityDTO> factoryQuantityDTOs
{
get
;
set
; }
}
public
class
FactoryQuantityDTO
{
[DataMember]
public
string
FactoryName {
get
;
set
; }
[DataMember]
public
int
? FactoryQuantity {
get
;
set
; }
}