Previously, you should have used temporary variables and the Columns.AddRange method to create cell bands.
Example:
Given GridView model:
C#public string Address { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Street { get; set; }
Creation syntax:
Razorsettings.Columns.Add(m => m.Address, c => { c.Columns.AddRange( new GridViewColumn[] { settings.Columns.Add(m => m.Country), settings.Columns.Add(m => m.City), settings.Columns.Add(m => m.Street), } ); });
or
Razorvar c1 = settings.Columns.Add(m => m.Country);
var c2 = settings.Columns.Add(m => m.City);
var c3 = settings.Columns.Add(m => m.Street);
settings.Columns.Add<string>(m => m.Address, c => {
c.Columns.AddRange(new GridViewColumn[] { c1, c2, c3, } );
});
Starting with version 19.2, we've changed the Columns.Add method overload. You can now use model-based properties and lambda expressions to create cell bands:
Razorsettings.Columns.Add(m => m.Address, c => { c.Columns.Add(m => m.Country); c.Columns.Add(m => m.City); c.Columns.Add(m => m.Street); });
Old method declaration:
C#public MVCxGridViewColumn<ValueType> Add<ValueType>(Expression<Func<RowType, ValueType>> expression, Action<MVCxGridViewColumn> method)
New method declaration:
C#public MVCxGridViewColumn<RowType> Add<ValueType>(Expression<Func<RowType, ValueType>> expression, Action<MVCxGridViewColumn<RowType>> method)
This change may affect your application.
Note: This breaking change relates only to scenarios where you use the Columns.Add method overload that accepts an action as a parameter.
For example, modify your code in the following manner and use a GridView’s mode type or the „var“ keyword if you store the Columns.Add method's result as a variable of the MVCxGridViewColumn<T> type:
Original code:
RazorMVCxGridViewColumn<string> addressColumn = settings.Columns.Add(m => m.Address, c => { c.Caption = "Address"; });
Use GridView's mode type:
RazorMVCxGridViewColumn<Person> addressColumn = settings.Columns.Add(m => m.Address, c => { c.Caption = "Address"; });
Use the "var" keyword:
Razorvar addressColumn = settings.Columns.Add(m => m.Address);
Additionally, in v19.2 use the following syntax …
Razorvar cAdress = settings.Columns.Add(m => m.CustomerAddress, c => { c.Caption = "Address"; }); cAdress.Columns.Add(m => m.CustomerAddress.Country); cAdress.Columns.Add(m => m.CustomerAddress.City); cAdress.Columns.Add(m => m.CustomerAddress.Street);
… if your model class contains complex properties and you rely on complex properties‘ types while using the Columns.Add method:
C#public class Customer {
public Address CustomerAddress { get; set; }
}
public class Address {
public string Country { get; set; }
public string City { get; set; }
public string Street { get; set; }
}
…
Razorvar cAdress = settings.Columns.Add(m => m.CustomerAddress, c => { c.Caption = "Address"; }); cAdress.Columns.Add(m => m.Country); cAdress.Columns.Add(m => m.City); cAdress.Columns.Add(m => m.Street);
This change may also affect your code if you cast a method parameter and/or the result of this method to MVCxGridViewColumn<T>.