Reputation: 1169
I have dev express grid view, and trying to set column visibility run time, Some columns are not appearing in correct order i.e. RebateAmount
i want to set to appear at 4th position but its appearing always on second position, any idea what's wrong in below code? i want all columns should be appear at position which i have set in visibility index.
if (currentColum.FieldName.Equals("TaxName"))
{
currentColum.Caption = @"abc";
}
else if (intGridType == 1 || intGridType == 0)//Both
{
if (currentColum.FieldName.Equals("PastCurrentCollectionTotal"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 15;
}
else if (currentColum.FieldName.Equals("PastCurrentCollectionVyajTotal"))
{
currentColum.Caption = @"Äyij";
currentColum.VisibleIndex = 16;
}
else if (currentColum.FieldName.Equals("PastCurrentCollectionNoticeFeeTotal"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 17;
}
else if (currentColum.FieldName.Equals("RebateAmount"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 18;
}
else if (currentColum.FieldName.Equals("PastCurrentCollectionTotalTotal"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 19;
}
else
currentColum.Visible = false;
}
else if (intGridType == 2)//Only Past
{
if (currentColum.FieldName.Equals("PastCollection"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 6;
}
else if (currentColum.FieldName.Equals("PastCollectionVyaj"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 7;
}
else if (currentColum.FieldName.Equals("PastCollectionNoticeFee"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 8;
}
else if (currentColum.FieldName.Equals("PastCollectionTotal"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 9;
}
else
currentColum.Visible = false;
System.Diagnostics.Debug.Print(currentColum.VisibleIndex.ToString() + currentColum.Name);
}
else if (intGridType == 3) //Only Current
{
if (currentColum.FieldName.Equals("CurrentCollection"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 10;
}
else if (currentColum.FieldName.Equals("CurrentCollectionVyaj"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 11;
}
else if (currentColum.FieldName.Equals("CurrentCollectionNoticeFee"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 12;
}
else if (currentColum.FieldName.Equals("CurrentCollectionTotal"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 13;
}
else if (currentColum.FieldName.Equals("RebateAmount"))
{
currentColum.Visible = true;
currentColum.VisibleIndex = 14;
}
else
currentColum.Visible = false;
}
Upvotes: 0
Views: 2524
Reputation: 11
Hide all columns and active ( Visible = true) one at a time in order you want
Upvotes: 1