[thelist] asp datagrid frustration

Greg Holmes greg.holmes at gmail.com
Thu Sep 23 04:54:54 CDT 2004


Mark Aldrich wrote:

>I have a search that is fired by an if
>'IsPostBack' test in the apps 'page load'
>sub. All well and good a reader object is
>bound to the grid with my data.

Can't tell for sure from the way you wrote
this, but typically the initial query would
be triggered by it NOT being a postback,
thus being the initial page load.

>The problem occurs when i sort a column. i
>have a sortcolumn handler which functions
>perfectly - i.e a requery of the database
>with a different sort expression. this is
>called when a hyperlink in the datagrid
>header is clicked. Unfortunately it goes
>through the page load sub again and of course
>it is a postback so before it calls the sort
> column sub, it automatically performs the
>same query again!!
>
>idealy clicking on the header would result
>in the ispostback test returning false or
>.somesuch logic. I know i could rewrite it
>in javascript  hehe but that wont be hapenin.

It almost sounds like you have it backward.
Do the inital query when it is NOT a postback.
Do modified queries when it IS a postback.

Greg Holmes


More information about the thelist mailing list