This question is locked. New answers and comments are not allowed.
Hi,
It seems that autogenerated GridView sets all its columns to horizontalAlignment=Left. I would like to set the horizontalAlignment cells depending on its dataType column. HorizontalAlignment should be:
How can I accomplish this?
It seems that autogenerated GridView sets all its columns to horizontalAlignment=Left. I would like to set the horizontalAlignment cells depending on its dataType column. HorizontalAlignment should be:
- Left for strings
- Right for numeric
- Center for boolean dataType
How can I accomplish this?
7 Answers, 1 is accepted
0
Hello Oscar,
You can gain control over the autogenerated columns in the AutoGeneratingColumn event of RadGridView.
Inside the event handler, you may alter the settings of each autogenerated column.
Let me know in case you need additional assistance on this .
Best wishes,
Pavel Pavlov
the Telerik team
You can gain control over the autogenerated columns in the AutoGeneratingColumn event of RadGridView.
Inside the event handler, you may alter the settings of each autogenerated column.
Let me know in case you need additional assistance on this .
Best wishes,
Pavel Pavlov
the Telerik team
0
Oscar
Top achievements
Rank 1
answered on 29 Mar 2011, 05:29 PM
Thank you, Pavel, but... I can't find the horizontalAligment property for the cell of the e.column.
0
Hi,
Vlad
the Telerik team
You can use GridViewColumn TextAlignment property to achieve your goal.
Kind regards,Vlad
the Telerik team
0
Oscar
Top achievements
Rank 1
answered on 30 Mar 2011, 09:12 AM
TextAlignment does not work for boolean dataType. The checkBox always appears aligned to the left for boolean dataType column.
0
Hi,
Vanya Pavlova
the Telerik team
For such columns you may also assign cell style with TargetType GridViewCell, where you may set the HorizontalContentAligment to an appropriate value and the checkboxes will be aligned correspondingly.
Vanya Pavlova
the Telerik team
0
Daniel
Top achievements
Rank 1
answered on 01 Oct 2012, 08:33 PM
How do i achieve this for all the grids in the project, as i do not want to write the auto generating event for every grid.
One way is to achieve this when autogeneratincolumn=true is to extend radgridview with control templates. can you provide me the control template of radgridview.
Thanks
One way is to achieve this when autogeneratincolumn=true is to extend radgridview with control templates. can you provide me the control template of radgridview.
Thanks
0
Hello,
Vlad
the Telerik team
You may want to create attached behavior and reuse it for all grids in your application. You can even bind your columns from a view-model similar to various our demos.
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.