This is a migrated thread and some comments may be shown as answers.

GridNumericColumn alignment

9 Answers 271 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christopher Borys
Top achievements
Rank 1
Christopher Borys asked on 19 Jan 2010, 07:00 PM
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

9 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Jan 2010, 05:51 AM
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.
0
Christopher Borys
Top achievements
Rank 1
answered on 21 Jan 2010, 01:11 AM
Eventually, I found this solution but what a lame fix......really.
0
yuvaraj
Top achievements
Rank 1
answered on 28 Sep 2016, 08:14 AM
7 years after still the same problem :-(
0
Viktor Tachev
Telerik team
answered on 30 Sep 2016, 12:51 PM
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.
0
yuvaraj
Top achievements
Rank 1
answered on 04 Oct 2016, 03:36 AM

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

0
Viktor Tachev
Telerik team
answered on 06 Oct 2016, 11:17 AM
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.
0
yuvaraj
Top achievements
Rank 1
answered on 07 Oct 2016, 01:33 AM

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.

0
Viktor Tachev
Telerik team
answered on 07 Oct 2016, 02:54 PM
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.
0
yuvaraj
Top achievements
Rank 1
answered on 10 Oct 2016, 01:28 AM

Hi viktor

Ok thanks

 

Regards

V.Yuvaraj

Tags
Grid
Asked by
Christopher Borys
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Christopher Borys
Top achievements
Rank 1
yuvaraj
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or