SJL,
I answered this on my blog:
http://www.manuelabadia.com/blog/Per...a039fb63e.aspx
The answer is this:
When the GridView needs data, a select operation is performed in the
underlying data source control. Before this operation is performed, a
method called CreateDataSourceSelectArguments is called on the
GridView. This method creates the arguments that will be passed to the
Select method of the ObjectDataSource, which in turns calls the method
specified by the property SelectMethod. In the
CreateDataSourceSelectArguments method, the SortExpression is set based
on the GridView's state and the ObjectDataSource just assign that
value to the sort parameter. So, as you can see, the DefaultValue is
never used for the sort parameter.
I hope it helps,
Manuel Abadia
SJL ha escrito:
I have a GridView (ASP.NET 2.0 + SQL Sever 2005) control that is bound to an
Object Data Source (ODS). The ODS has a SelectParameter for the sort
expression. The SelectParameter has a DefaultValue defined, however when the
page intitially loads, that DefaultValue is not passed to my SelectMethod. I
have sorting enabled, so when I do subsequent sorts on the GridView, the
pSortExpression value is passed and sorting works, but for some reason, the
default value is never used.
I can explicitly set it in the page load calling the GridView.Sort method,
but I don't see why I should have to. Any ideas why the DefaultValue of my
SelectParameters don't work?
Thanks,
SJL