Currency Symbol inconsistency & Other

6 posts, 0 answers
  1. Stephen Rouse
    Stephen Rouse avatar
    23 posts
    Member since:
    Feb 2005

    Posted 09 Nov 2012 Link to this post

    I have set up a grid to produce an Invoice "view" tht can be displayed in three or four formats, although I am just working on the test grid now, the xaml for this is below.
    <telerik:RadGridView x:Name="ScopeGridView" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" GridLinesVisibility="Vertical" VerticalGridLinesBrush="{StaticResource AccentBrush}" HorizontalGridLinesBrush="{StaticResource BasicBrush}"
                         AutoGenerateColumns="False" AutoExpandGroups="True"
                         ShowGroupFooters="True" >
        <telerik:RadGridView.Resources>
            <Style TargetType="telerik:GroupHeaderRow" >
                <Setter Property="ShowGroupHeaderColumnAggregates" Value="False" />
                <Setter Property="ShowHeaderAggregates"  Value="False" />
            </Style>
        </telerik:RadGridView.Resources>
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Quantity, Mode=TwoWay, StringFormat=\{0:F2\}}" IsFilterable="False" Header="Quantity" CellStyle="{StaticResource ValuecellStyle}" IsReadOnly="True" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding product.Name}" IsFilterable="False" Header="Product Name" IsReadOnly="True" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding LineTotal, StringFormat=\{0:c\}}" IsFilterable="False" Header="Price" IsReadOnly="True" >
                <telerik:GridViewDataColumn.AggregateFunctions>
                    <telerik:SumFunction SourceField="LineTotal" ResultFormatString="Total: {0:c}" />
                </telerik:GridViewDataColumn.AggregateFunctions>
            </telerik:GridViewDataColumn>
        </telerik:RadGridView.Columns>
        <telerik:RadGridView.GroupDescriptors>
            <telerik:GroupDescriptor Member="RoomName" SortDirection="Ascending" >
            </telerik:GroupDescriptor>
        </telerik:RadGridView.GroupDescriptors>
    </telerik:RadGridView>
    In the columns the currency symbol is a $, where is the group "footer" and the header have the desired symbol of £. I have looked at one of the samples and this has the same issue!!! Is there a resolution? Also in the same example, you can switch off the Header Aggregate (?), I have used the same code but it does not switch off!

    Finally, the class has some vaildation on a couple of fields, and it is showing the validation errors in the grid, even though these fields are not being shown. Is there a way of switching of the validation in the Grid View?

    Thanks in Advance.

    Steve 
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 09 Nov 2012 Link to this post

    Hello Steve,

    As to your questions one by one:

    1. As you would like to change the formatting for the column values, then you should set an appropriate Current Culture. Please check out our localization documentation for further information. Then please keep in mind that the column values are formatted based on the Culture specified as a Language for the GridView (or the containing Page). You could as well check this troubleshooting article.

    2. Please set GroupRenderMode="Flat" for the RadGridView. This is what is missing.

    3. I am not sure how have you defined your columns and what are the validation errors you got. Would you please share some more details on the exact case that you have?

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Stephen Rouse
    Stephen Rouse avatar
    23 posts
    Member since:
    Feb 2005

    Posted 09 Nov 2012 Link to this post

    Firstly thank you for the help re the currency symbol, i added the following to the usercontrol page
    Dispatcher.BeginInvoke(new Action(() => this.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name)));
    And it cleared the error!

    As for the validation issue, the class is defined as thus:
    public class ccRoomProduct
    {
        public String RoomName { get; set; } // The name of the room
        public ccProduct product { get; set; } // The product from the catalogue can be null if a Write-in
        public Decimal Labour { get; set; } // The monetary labour component of the taotal cost
        public Decimal Materials { get; set; } // The monetary Material component of the total cost
        public Decimal LineTotal { get; set; } // The total amount of the product
        public Decimal LabourPercentage { get; set; } // The component expressed as a percentage
        public Decimal MaterialPercentage { get; set; } // The component expressed as a percentage
        public string QuantityMask { get; set; } // A Mask to indicate the number of decimal places for the quantity e.g. #.## indicates 2 decimal places
        public Decimal Quantity { get; set; } // The quantity
     
        [Required(ErrorMessage = "A description is required")]
        public String Description { get; set; } // Description of the product
     
        [Required(ErrorMessage = "A reason is required")]
        public String Note { get; set; } // A note about why the product has been added.
        public Boolean IsWriteIn { get; set; } // Indicates that this is a write-in product
     
        //[Required(ErrorMessage = "You must enter a unit of measure")]
        public String UnitOfMeasure { get; set; } // The unit of measure per 'item'
     
        [Required(ErrorMessage = "A Name for this item is required")]
        public String ProductName { get; set; } // The product Name

    As you can see in the attached screen print, the rows have a red border, the Required fields can be null, but only when they are "inherited" from the product, any item added by the user MUST have these fields. When I remove the annotations (or comment them out) the red boarders disappear. I can create a "clone" class without the Annotations but was hoping to avoid this.

    Thank You in advance

  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Nov 2012 Link to this post

    Hi,

    You can control the validation through the ValidateOnDataErrors property of the RadGridView. Please try setting it and let me know what the result is?

    Greetings,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Stephen Rouse
    Stephen Rouse avatar
    23 posts
    Member since:
    Feb 2005

    Posted 12 Nov 2012 Link to this post

    I was looking for a property like that and could not see it, until now :-) Thanks that worked!
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 08 Feb 2013 Link to this post

    Hello,

    In addition to my last answer regarding the currency symbol inconsistency, I would like to inform you that we have introduced a new property IsLocalizationLanguageRespected of GridViewDataControl especially for such cases. It is available in our latest internal build. 

    Its default value is 'true' meaning that the formatting is based on the Language property (default behaviour). Once you set it to 'false", then the CurrentCulture will be respected. 

    All the best,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner