GridNumericColumn alignment

10 posts, 0 answers
  1. Christopher Borys
    Christopher Borys avatar
    19 posts
    Member since:
    Sep 2009

    Posted 19 Jan 2010 Link to this post

    In my opinion, there is a bug in alignment of the GridNumericColumn and possibly other columns as well.
    Numeric column default justification formating should be RIGHT.  Moreover, if the (ItemStyle-HorizontalAlign="Right") is set, there should not be any questions how the content is supposed to be aligned.  However, when going to EDIT MODE (InPlace), the edit box show the content on the LEFT.  Even, if I asign the style for the edit box in the ItemDataBound() as follows:

    textbox = (

    RadNumericTextBox)editItem["AmountPayorFC"].Controls[0];

     

    textbox.NumberFormat.AllowRounding =

    true;

     

    textbox.NumberFormat.DecimalDigits = 0;

    textbox.Style.Add(

    "text-align", "right");

     


    the edit box shows the content on the LEFT.  When I click inside the box, then the content switches to the RIGHT.
    I am using IE8.   This is very anoying and incorrect.


    Chris
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Jan 2010 Link to this post

    Hi Christopher,

    You can try setting the css class for the RadNumericTextbox as shown below:
    c#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                GridEditableItem dataItem = (GridEditableItem)e.Item; 
                RadNumericTextBox rdnmrctxtbx = (RadNumericTextBox)dataItem["AmoutPayorFC"].Controls[0]; 
                rdnmrctxtbx.CssClass = "myclass";             
            } 
        } 

    css:
     .myclass 
        { 
          text-align:right !important; 
        } 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Christopher Borys
    Christopher Borys avatar
    19 posts
    Member since:
    Sep 2009

    Posted 20 Jan 2010 Link to this post

    Eventually, I found this solution but what a lame fix......really.
  5. yuvaraj
    yuvaraj avatar
    4 posts
    Member since:
    Aug 2016

    Posted 28 Sep Link to this post

    7 years after still the same problem :-(
  6. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 30 Sep Link to this post

    Hello,

    Would you ensure that you are using the latest version of the controls and see if the behavior is different? The latest release is version 2016.3.914.

    In case the behavior persists would you open a support ticket and send us a screenshot and more detailed information on your scenario and the issue you are having.

    It would be great if you can submit a runnable sample replicating the problematic behavior. Thus we will be able to examine the issue locally and look for its cause.

    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  7. yuvaraj
    yuvaraj avatar
    4 posts
    Member since:
    Aug 2016

    Posted 03 Oct in reply to Viktor Tachev Link to this post

    Hello Viktor

    Thanks for the response.

    Telerik Rad grid EditMode="Batch" and the code is 

     <telerik:GridNumericColumn DataField="I_RATE" HeaderText="Currency Rate" UniqueName="Rate" HeaderStyle-Width="200px" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" MaxLength="2">
                            <ItemStyle HorizontalAlign="Right"></ItemStyle>
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" Text="*" Display="Dynamic">
                                </RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridNumericColumn>

     

    My problem is Currency rate column is right aligned - no pproblem but when i Add an item or edit Currency rate column, the typable box is not right aligned. Please see the attached file and you can easily understand the problem.

     

    Thanks again

  8. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 06 Oct Link to this post

    Hi,

    Thank you for the clarification. To modify the appearance of the NumericTextBox you can use an external editor for RadGrid.


    The markup would look similar to the following:

    <telerik:GridNumericColumn DataField="I_RATE" HeaderText="Currency Rate" UniqueName="Rate" ColumnEditorID="NumericEditor1"
        HeaderStyle-Width="200px" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
        <ItemStyle HorizontalAlign="Right"></ItemStyle>
        <ColumnValidationSettings EnableRequiredFieldValidation="true">
            <RequiredFieldValidator ForeColor="Red" Text="*" Display="Dynamic">
            </RequiredFieldValidator>
        </ColumnValidationSettings>
    </telerik:GridNumericColumn>


    <telerik:GridNumericColumnEditor runat="server" ID="NumericEditor1">
        <NumericTextBox runat="server" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" ></NumericTextBox>
    </telerik:GridNumericColumnEditor>



    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  9. yuvaraj
    yuvaraj avatar
    4 posts
    Member since:
    Aug 2016

    Posted 06 Oct in reply to Viktor Tachev Link to this post

    Hi Viktor,

    Great, that's solved my issue. I also had the problem of setting the MaxLength. That's also solved with your solution.

     <telerik:GridNumericColumnEditor runat="server" ID="NumericEditor1">
                    <NumericTextBox runat="server" EnabledStyle-HorizontalAlign="Right" FocusedStyle-HorizontalAlign="Right" MaxLength="10"></NumericTextBox>
                </telerik:GridNumericColumnEditor>

    Thank you very much.

  10. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 07 Oct Link to this post

    Hello,

    I am glad that the suggested approach is working for you.

    If you would like to limit the maximal value that can be entered in the numeric input it is recommended to use the MaxValue property.


    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  11. yuvaraj
    yuvaraj avatar
    4 posts
    Member since:
    Aug 2016

    Posted 09 Oct in reply to Viktor Tachev Link to this post

    Hi viktor

    Ok thanks

     

    Regards

    V.Yuvaraj

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017