Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ObjectDataSource SortParameterName Not Sorting

Status
Not open for further replies.

Meleagant

Programmer
Aug 31, 2001
166
US
All,

I have an ObjectDataSource and a grid view. I have set the SortParameterName property in the client side definition of the ObjectDataSource as well as included that Property name in my Select Method. When I click the grid header noting happens. The page posts back but the grid is returned in the original order.

Debugging the page I found that the value of SortParameter in my Select method is "". How do I set the value of "sortParameter"

ASPX Page:
Code:
<asp:ObjectDataSource ID="ods1" runat="server" SelectMethod="GetSearchData" TypeName="GridViewHelper" 
SortParameterName="sortParameter">                                  
<SelectParameters>
 ...
</SelectParameters> 
</asp:ObjectDataSource>

<asp:GridView ID="gv1" runat="server" AutoGenerateColumns="false" AllowSorting="true"
ShowHeader="true" Enabled="true" GridLines="both" EnableViewState="false" DataKeyNames="PatNum" Height="300px">

In the Select Method:
Code:
Public Shared Function GetSearchData(ByVal sortParameter As String, ByVal NumberSearch As Boolean, ByVal EpisodeNumber As String, ByVal EnterpriseNumber As String, ByVal FirstName As String, ByVal LastName As String) As DataSet

  ... Get SQL and DataSet  ...

        Dim oConn As OracleConnection = New OracleConnection()
        oConn.ConnectionString = ConnStr
        oConn.Open()

        Dim oCmd As New OracleCommand(SqlStr, oConn)

        Dim oAdapter As New OracleDataAdapter
        oAdapter.SelectCommand = oCmd

        Using oAdapter
            oAdapter.Fill(ds)
        End Using

        Return ds

End Function

I've read articles where I should send the function back as a dataview. Where inside the function I should call dv.Sort = SortParameter. That didn't work either because sortParameter is "".

Any help would be great.

Thanks
-- Joe --



Journeyman -- The Order of the Seekers of Truth and Penitence
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top