I'm trying to add sorting functionality to an old asp:Gridview and for some reason it is being a real pain to work with. I have tried multiple different things and failed. I would really appreciate some help with this. I have looked at examples at The Code Project and MSDN, but nothing is helping me. Here is my latest code:
<asp:SqlDataSource ID="grdVwCustomer_DataSource" runat="server" 
 ConnectionString="<%$ ConnectionStrings:DBConnectingString %>">
</asp:SqlDataSource>
<asp:Gridview ID="grdVwCustomer" runat="server" AutoGenerateColumns="false" 
  AllowSorting="true" DataKeyNames="CustomerID" OnSorting="grdVwCustomer_Sorting"
  DataSourceID="grdVwCustomer_DataSource">
 <asp:TemplateField HeaderText="User Name" SortExpression="UserName">
  <ItemTemplate>
     <%# DataBinder.Eval( Container.DataItem, "UserName" )%> 
  </ItemTemplate>
 </asp:TempateField>
</asp:Gridview>
protected void Page_Load( object sender, EventArgs e )
    {
        string query = "SELECT * FROM vPanel_Customer WHERE DeletionStateCode=0";
        grdVwCustomer_DataSource.SelectCommand = query;
        grdVwCustomer.DataBind();
    }
protected void grdVwCustomer_Sorting(object sender, GridViewSortEventArgs e)
    {
        DataBind(Convert.ToBoolean(e.SortExpression)); ****this line gets the error****
    }
EDIT:
 protected void grdVwCustomer_Sorting(object sender, GridViewSortEventArgs e)
    {
        switch (e.SortExpression)
        {
            case "UserName":
                if (e.SortDirection == SortDirection.Ascending)
                {
                    String queryString = "SELECT * FROM vPanel_Customer WHERE DeletionStateCode=0 ORDER BY UserName";
                    DataSet ds = GetData(queryString);
                    if (ds.Tables.Count > 0)
                    {
                        grdVwCustomer.DataSource = ds;
                        grdVwCustomer.DataBind();
                    }
                    else
                    {
                        //show message to user
                    }
                }
                break;
        }
    }
DataSet GetData(String queryString)
    {
        // Retrieve the connection string stored in the Web.config file.
        String connectionString = ConfigurationManager.ConnectionStrings["DBConnectingString"].ConnectionString;
        DataSet ds = new DataSet();
        try
        {
            // Connect to the database and run the query.
            SqlConnection connection = new SqlConnection(connectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);
            // Fill the DataSet.
            adapter.Fill(ds);
        }
        catch (Exception ex)
        {
            Logging.Log.LogException(Forbin.Logging.PageType.CustomerManage,   Logging.MessageType.Exception, ex.ToString());
            UIUtils.ShowMessageToUser("OnErrorMesg", this.Page);
        }
        return ds;
    }
The error Guid should be 32 digits... shows on this line CustomerID = new Guid(e.CommandArgument.ToString());
 
     
    