Register  Login  
  February 6, 2012  
Search_Blog Minimize
Print  

Blog_Archive Minimize
Print  

Blog    
View_Blog Minimize
Jan 29

Written by: host
Sunday, January 29, 2006 12:48 PM 

I was advised by a user of SQLGridSelectedView (thanks Roy Dean) that column sorting did not function when using column formatting - the latest feature to be added to SQLGridSelectedView.

Sure enough - the initial page would display, but clicking on a column to sort would result in an empty display.  Simply put, the OnSortCommand was not firing. In the case of column formatting, SQLGridSelectedView turns off the AutoGenerateColumns property and must create the column structure manually. A quick check of the forums confirmed my oversite of not providing the SortExpression on the columns.   Simple. 20 miuntes -  Added one line of code and done -- Not so fast - still didn't work ???

So, back to the forums and a lot of reading and testing... still no luck.  Then a post indicated that the Column definition must be defined prior to the Page_Load event - so I must define the column definitions in the Page_Init event.  What?  Why?

I was getting the initial display by defining the columns in the Page_Load and the Datagrid was being populated as needed... my problem is the OnSortCommnad was not firing not when to define the columns.  More reading...

Seems, that the columns need to be defined so the information stored in the ViewState has a place to work. The ViewState in unloaded between the Page_init and Page_load. If the columns are not defined in the Page_init, then with no structure to work with, the OnSortCommand is not bound to the appropriate routine - basically it doesn't have the SortExpression, so won't fire. OK ... this makes sense.

But SQLGridSelectedView does not "know" the column structure until the module executes the first time.  So, I can't load the structure in the Page_init on the first execution as I may not have the result of the user input until the user enters data.

My solution is to save the column names on the first execution of the display and resue that information on postbacks where I can create the column structure in the Page_init event.  Thus, when the viewstate is unloaded, the OnSortCommand is hooked up correctly and fires as required.

Version V3.3d of SQLGridSelectedView now correctly allows column sorting when column formating is being used.  Oh, and I fixed a little issue the the Header do displaying properly is some situations.

So -- this is another fine example of the 20-minute rule.  QED!

Tags:

1 comment(s) so far...

Re: Chinese Footware - and the removal of...

GameCoach Factory Outlet Onlineare usuallyCoach Factoryin By Coach Outlet Online on   Thursday, February 02, 2012 1:27 AM


Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 

Blog_List Maximize
Print  

  Home | Blog | Forum | Subscriptions | Free Modules | Videos   Page generated in 0.1252048 seconds.
  Copyright 2010 by TressleWorks   Terms Of Use | Privacy Statement