What's wrong with my custom sort method?

I'm going to have a page that contains many gridview controls. I'm trying to create a custom sort method for my GridView controls. I have an organic example that works just fine in my code.

        protected void myGridViewControl_Sorting(object sender, GridViewSortEventArgs e)
        {
            //PSUEDO CODE NOT WRITTEN FOR CORRECTNESS
            DataSet myDataSet = new DataSet();
            myDataSet  = myGridViewControl.Sort(someData, e.SortExpression).ToList();
        }

Open in new window


...and this works fine. So I try to then, I add another grid view control and use that grid's OnSorting method to pass the GridView control to my custom method. In essence, passing my grid and its GridViewSortEventArgs to my new global sorting method:

        protected void dtgClinicScheduledEvents1_Sorting(object sender, GridViewSortEventArgs e)
        {
            SortAllGrids(sender, e);
        }
.
.
.
        protected void SortAllGrids(object sender, GridViewSortEventArgs e)
        {
            GridView gridView = (GridView)sender;
            string strID = gridView.ID;

            myCustomCollection myLocalColletion= new
                               myCustomCollection().BinaryDeserialize(Session[mySessionVariable] as string);
            myLocalColletion.AccecptColletion = gridView.Sort(myLocalColletion.AccecptColletions, gridView.SortExpression).ToList();
            Session[mySessionVariable] = myLocalColletion.BinarySerialize();
        }

Open in new window



I'm getting a few errors in my custom sort method that I don't understand. If you can accept that the 1st line of code and the 3rd line of code (marked above with 1 and 3) are correct, then the compile time errors I'm getting are as follows:
  1. Now, my "myLocalColletion.AccecptColletions" object is telling me that the 1st parameter of the grid's sort method, needs to be a string? Why

2. My second parameter now is now expected to be a string. Why is it no longer a string, it was before in the "organic" Sorting method.

3. Lastly, the "." is error-ing out at compile time telling me that: "Operator "." cannot be applied to operand of type" void'". Again, this was not the case before, so why is it now?
LVL 1
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Miguel OzSoftware EngineerCommented:
Please change: (Notice e replaces gridView)
myLocalColletion.AccecptColletion = gridView.Sort(myLocalColletion.AccecptColletions, gridView.SortExpression).ToList();
with:
myLocalColletion.AccecptColletion = gridView.Sort(myLocalColletion.AccecptColletions, e.SortExpression).ToList();

Open in new window

If more help needed please provide more details about myCustomCollection() and what is the initial value of Session[mySessionVariable]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael SterlingWeb Applications DeveloperAuthor Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.