C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-10-2005, 07:43 PM   #1
unleashed
 
alphaoide's Avatar
 
Join Date: Sep 2003
Posts: 693
SortCommand Event

I hope I give you enough info below. Basically I have a DataGrid dgQuick with AllowSorting set.

When I click one of the header title to invoke the DataGridSortCommandEventHandler, the section B is only executed if line A exists. I need to be able to execute section B without having line A.

Code:
        private void Page_Load(object sender, System.EventArgs e)
        {
            dgQuick.SortCommand +=
                new DataGridSortCommandEventHandler(dgQuick_SortCommand);

            if (!Page.IsPostBack)
            {
                bindData("ID");
            } 
            bindData("Subject");  // LINE A ####
        }

        private void dgQuick_SortCommand(object source,
            DataGridSortCommandEventArgs e) 
        {
            // SECTION B ####
            Response.Write("dgQuick_SortCommand");
            bindData(e.SortExpression);
        }

        private void bindData(String sortExpression) 
        {        
            Response.Write(sortExpression);
            taskManager = new TaskManager(Server.MapPath(@"data\data.xml"));
            TaskList ts = taskManager.GetTaskList();
           
            TaskComparer comparer = new TaskComparer(sortExpression);
            ts.Sort(comparer);
          
            dgQuick.DataSource = ts;
            dgQuick.DataBind();

        }
__________________
source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense
alphaoide is offline   Reply With Quote
Old 11-12-2005, 01:21 PM   #2
unleashed
 
alphaoide's Avatar
 
Join Date: Sep 2003
Posts: 693
Solved it. The problem was I had the EnableViewState set to false
__________________
source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense
alphaoide is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 10:29 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22