G
Guest
I am adding boundColumns to my DataGrid via code-behind using the following
code:
BoundColumn bc = new BoundColumn();
bc.HeaderText = "Users";
bc.DataField = "vUserId";
bc.SortExpression = "vUserId";
dg_Users.Columns.AddAt(0, bc);
The boundColumns are added fine, along w/ the rest of the columns in my
datatable. However, when i set the AutoGenerateColumns property to false so
that only the BoundColumns show, the SortCommand no longer fires:
dg_Users.AllowPaging = true;
dg_Users.PageSize = 2;
dg_Users.DataKeyField = "vUserId";
dg_Users.AllowSorting = true;
dg_Users.AutoGenerateColumns = false;
The SortCommand is wired in the InitializeComponent method as follows:
this.dg_Users.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.SortCommand);
Any ideas? Thanks.
code:
BoundColumn bc = new BoundColumn();
bc.HeaderText = "Users";
bc.DataField = "vUserId";
bc.SortExpression = "vUserId";
dg_Users.Columns.AddAt(0, bc);
The boundColumns are added fine, along w/ the rest of the columns in my
datatable. However, when i set the AutoGenerateColumns property to false so
that only the BoundColumns show, the SortCommand no longer fires:
dg_Users.AllowPaging = true;
dg_Users.PageSize = 2;
dg_Users.DataKeyField = "vUserId";
dg_Users.AllowSorting = true;
dg_Users.AutoGenerateColumns = false;
The SortCommand is wired in the InitializeComponent method as follows:
this.dg_Users.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.SortCommand);
Any ideas? Thanks.