Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

ASPxGridView - How to sort the columns placed in the CustomizationWindow based on their visible index

$
0
0

By design, ASPxGridView orders columns in CustomizationWindow based on a column's caption. Thus, it is necessary to change the column caption to change its order in the CustomizationWindow. Adding an index before the caption allows you to set the custom column order:

[C#]
protectedvoidgridView_BeforeGetCallbackResult(objectsender,EventArgse){intcurrentIndex= 0;foreach(GridViewDataColumncolumningridView.DataColumns){if(column.Visible==false)currentIndex++;stringcaption=System.Text.RegularExpressions.Regex.Replace(column.FieldName,"(?=[A-Z][a-z])|(?<=[a-z])(?=[A-Z])"," ",System.Text.RegularExpressions.RegexOptions.Compiled).Trim();column.Caption=!column.Visible?string.Format("{0}) {1}",currentIndex.ToString("D2"),caption):caption;}}

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>