I have done whatevery I can think of but it still doesn't work....please help me
void my_SortCommand(Object sender, DataGridSortCommandEventArgs e){
BindDataGrid(e.SortExpression);
}
void BindDataGrid( string strSortField )
{
con = new SqlConnection( @"Server=Rabbit;Integrated Security=SSPI;database=pubs" );
query = "Select * from organizations order by city";
SqlDataAdapter myCommand = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
myCommand.Fill(ds, "organizations");
DataView Source = ds.Tables["organizations"].DefaultView;
Source.Sort = strSortField;
companyInfo.DataSource=Source;
companyInfo.DataBind();
}
<asp:DataGrid id="companyInfo" Runat="Server" AllowSorting="True" OnSortCommand="my_SortCommand" EnableViewState="false" HeaderStyle-Font-Bold="False" CellPadding="10" AutoGenerateColumns="False">
Anything wrong?