Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Format is ignored when a column is bound to a WebNumericEdit control
posted

I have a column definition in an UltraWebGrid that looks like this...

With uwgStudent.Columns
    .Add("lHours", "Hours")
    .With .FromKey("lHours")
        .Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom
        .EditorControlID = wneHours.UniqueID
        .CellStyle.HorizontalAlign = HorizontalAlign.Right
        .DataType =
GetType(Decimal).ToString
        .Format =
"0.00"
    End With
End With

The control wneHours is defined as
<igtxt:WebNumericEdit runat="server" ID="wneHours" CssClass="value" Width="40px" MaxLength="4" MinValue = "-10" MaxValue="10" />

When the cell is originally populated the value is displayed using the fomat i.e. 2.00 but after editing the format is redisplayed without a format i.e. 2. If I remove the .Type and .EditorControlID lines it works just fine.

Does anyone have any thoughts or is this just another bug?

Thanks - Terry Hutt

  • 45049
    posted

    I expect that the Format property of a WebGrid column will probably be ignored by any embeddable editor that doesn't itself have a similar property.  WebNumericEdit doesn't have a Format property.

    So, what's likely happening is that the grid obeys the Format property when the page is first rendered, but your WebNumericEdit doesn't know what to do with it and thus ignores it.

    In this case, try setting the MinDecimalPlaces property of your WebNumericEdit to MinDecimalPlaces.Two.  Alternately, you can provide a different NumberFormatInfo object to the NumberFormat property of the WebNumericEdit.