Sorting Datagrid with a Select Column - Does not work!

Discussion in 'ASP .Net' started by Sinan, Jan 28, 2005.

  1. Sinan

    Sinan Guest

    Hi

    I am using a datagrid with a Select Column and the SelectedIndexChanged event captures the values of the cells in the selected row.

    It works fine before sorting any column. The problem starts when I sort a column and then select a row, it gives me the data of another row! Not the row I have selected

    Any idea what is going wrong? Your help is highly appreciated

    Here is the sort procedure I am using

    "Private Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles DataGrid1.SortComman

    strSql = "select * from dvSTD1 order by " &
    e.SortExpression.ToString(

    Dim objConn As New SqlConnection(strConnTxt
    objConn.Open(

    Dim objCmd As New SqlCommand(strSql, objConn

    DataGrid1.DataSource = objCmd.ExecuteReader(
    DataGrid1.DataBind(

    objConn.Close(
    End Sub"

    ---
    Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
     
    Sinan, Jan 28, 2005
    #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. =?Utf-8?B?U2FtZWVrc2hh?=

    DataGrid Sorting does not work

    =?Utf-8?B?U2FtZWVrc2hh?=, Sep 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,287
    =?Utf-8?B?U2FtZWVrc2hh?=
    Sep 24, 2004
  2. TB
    Replies:
    2
    Views:
    3,763
  3. Keithb
    Replies:
    2
    Views:
    1,162
  4. Greg Smith
    Replies:
    0
    Views:
    546
    Greg Smith
    Apr 12, 2007
  5. Veeves

    Datagrid sorting does not work

    Veeves, Mar 18, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    110
    Veeves
    Mar 18, 2005
Loading...

Share This Page