Late bound sort of gridview

Discussion in 'ASP .Net Web Controls' started by Haim Katz, Aug 11, 2007.

  1. Haim Katz

    Haim Katz Guest

    I have a gridview in asp.net 2.0 which is late bound to a datasource
    depending upon user selections on the form. The data shows up in the
    grid, but clicking on the column headers does not sort the data and
    causes it to disappear.

    How can I handle the sort so that it works?

    Here is the code:
    Dim mywhere As String
    Dim repview, selectstring As String
    Dim myarg As New System.Web.UI.DataSourceSelectArguments()

    'select clause that detects which report to load
    Select Case Me.ddReptype.SelectedValue
    ....

    Case 3 'Quality
    repview = "QualityRepView"

    End Select
    selectstring = "select * from " & repview


    'gets where clause from various dropdownlists
    mywhere = getWhereClause()

    selectstring += " Where " & mywhere

    Me.GridView1.AllowSorting = True

    Me.SDSReports.SelectCommand = selectstring
    Me.SDSReports.Select(myarg)
    Me.GridView1.DataSourceID = "SDSReports"
    'Me.GridView1.DataSource = Me.SqlDataSource1


    Me.GridView1.DataBind()
     
    Haim Katz, Aug 11, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sunil panda

    Lower bound & Upper bound

    sunil panda, Dec 25, 2003, in forum: Java
    Replies:
    9
    Views:
    7,253
    thushara wijeratna
    Oct 7, 2008
  2. Replies:
    0
    Views:
    731
  3. Replies:
    2
    Views:
    866
    Kevin Grover
    Oct 20, 2006
  4. Replies:
    1
    Views:
    493
    Vadivel Kumar
    Jun 27, 2006
  5. Navin
    Replies:
    1
    Views:
    705
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page