i cant believe its not butter...or that i wrote this
The Weird and The Wonderful
1
Posts
1
Posters
0
Views
1
Watching
-
the point was to do 2 column reversable order sorting, i wrote this thing as an intern.. have fun guys and gals.
int t1 = 0; int t2 = 0; string temp = ""; string orig = ""; if (lblSortOrder.Text==e.SortExpression)//if they click the same column reverse order { Trace.Write("asdf","in order switcher"); lblSortOrder.Text +=" DESC"; } else if (lblSortOrder.Text.IndexOf(e.SortExpression)== -1)//if they click a different column use both sort terms { Trace.Write("asdf","in column adder"); temp=e.SortExpression; temp+=", "+lblSortOrder.Text; lblSortOrder.Text=temp; } else if (lblSortOrder.Text.IndexOf(',')!=-1)//if the first two fail and is a multi column search { if (lblSortOrder.Text.IndexOf(e.SortExpression)!=-1)//if expression is in the sort string, make it primary and reverse its order { orig=lblSortOrder.Text; t1=orig.IndexOf(e.SortExpression); t2=orig.IndexOf(",",t1)-t1; if(t2>=0) { temp=orig.Substring(t1,t2); } else { temp=orig.Substring(t1); } //Trace.Write("orig after substring",orig); //Trace.Write("temp",temp); if(temp.IndexOf("DESC")!=-1) { orig=orig.Remove(t1,temp.Length); temp=temp.Remove(temp.IndexOf("DESC"),4); temp=temp.Trim(); //Trace.Write("remove desc",temp); } else { orig=orig.Remove(t1,temp.Length); temp+=" DESC"; temp=temp.Trim(); //Trace.Write("add desc",temp); } orig=orig.Trim(); lblSortOrder.Text=temp+","+orig; }//end if sort expression contained in sort string else { lblSortOrder.Text=e.SortExpression; //Trace.Write("???","you sho