我有开发表达网格视图,并试图设置列可见性运行时间,有些列没有按正确顺序出现,即RebateAmount
我想设置为出现在第4个位置,但它始终显示在第二个位置,任何想法下面的代码有什么问题?我希望所有列都出现在我在可见性索引中设置的位置。
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;
}
答案 0 :(得分:1)
按照您想要的方式一次隐藏所有列并激活(Visible = true)