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();
...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)
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();
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:
- 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?