Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5960019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:46:01+00:00 2026-05-22T18:46:01+00:00

using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;

  • 0
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;

using BiscomFax;


namespace FaxServer
{
    public partial class _Default : System.Web.UI.Page
    {
        public const string vsColumn = "Column";
        public const string vsSortDirection = "SortDirection";

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
                ViewState[vsColumn] = "";
            List_Click(ActivityButton, e);
        }

        protected void List_Click(object sender, EventArgs e)
        {
            //using (new Impersonator("administrator", "mlabs.com", "100%secure*"))
            //{
                try
                {
                    Fax fax = new Fax();
                    ConnObj cnObj = GetConfiguration();
                    Button btn = (Button)sender;
                    string sort = "";

                    DataTable dt = new DataTable();

                    switch (btn.CommandName)
                    {
                        case "Activity":
                            sort = "DateTime";
                            dt = fax.GetActivityLog(cnObj.faxDir, cnObj.faxUsername, cnObj.faxPassword);
                            break;
                        case "Message":
                            sort = "DateTime";
                            dt = fax.GetMessageStatus(cnObj.faxDir, cnObj.faxUsername, cnObj.faxPassword);
                            break;
                        case "Pending":
                            sort = "DeliveryTime";
                            dt = fax.GetPendingList(cnObj.faxDir, cnObj.faxUsername, cnObj.faxPassword);
                            break;
                        default:
                            sort = "DateTime";
                            dt = fax.GetActivityLog(cnObj.faxDir, cnObj.faxUsername, cnObj.faxPassword);
                            break;

                    }

                    GridView1.DataSource = dt;
                    GridView1.Sort(sort, SortDirection.Descending);
                    GridView1.DataBind();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            //}
        }



        protected void gridView_Sorting(object sender, GridViewSortEventArgs e)
        {

            DataTable dt = GridView1.DataSource as DataTable;

            if (dt != null)
            {
                DataView dv = new DataView(dt);
                string oldSort = ViewState[vsColumn].ToString();

                dv.Sort = e.SortExpression + " " + convertSorDirectionToSql(e.SortDirection);

                if (dv.Sort == oldSort)
                    dv.Sort = e.SortExpression + " " + convertSorDirectionToSql(SortDirection.Descending);

                ViewState[vsColumn] = dv.Sort;

                GridView1.DataSource = dv;
                GridView1.DataBind();
            }

        }

i am having a very difficult time sorting the contents of this gridview, i know that i am binding correctly becuase the data is showing but the data does not get sorted at all by DateTime. what am i doing wrongly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:46:01+00:00Added an answer on May 22, 2026 at 6:46 pm

    Lets look at this line

     dv.Sort = e.SortExpression + " " + convertSorDirectionToSql(e.SortDirection);
    

    While testing, when you put a breakpoint on this line what value did e.SortExpression have?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GenericCount { class Program {
Consider the following snippet: using System; using System.Collections.Generic; using System.Linq; using System.Net; namespace ForumLogins
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; namespace ConsoleApplication2 { class
This is my problem: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1
This is what I have so far using System; using System.Collections.Generic; using System.Data.Linq; using
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ConsoleApplication1 { class
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; That's my namespaces. I
Given these classes: using System.Collections.Generic; namespace FluentMappingsQuestion { public class Entity { public virtual
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using ModelLayer.PocoModels; using System.Data.Objects;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.