the default view, such as
but when I user the custom sort,the radgrid view become follows:
- id name
- 1 tom
- 2 jack
but when I user the custom sort,the radgrid view become follows:
- id name
- 1 tom system.data.datarowview system.data.datarowview
- 2 jack system.data.datarowview system.data.datarowview
when I sort one time,the view will add two columns,who can help me?
the source code:
the source code:
protected
void
Page_Init(
object
sender, EventArgs e)
{
GridBoundColumn idColumn =
new
GridBoundColumn();
idColumn.DataField =
"Id"
;
idColumn.Display =
true
;
idColumn.SortExpression =
"Id"
;
idColumn.UniqueName =
"Id"
;
idColumn.HeaderText =
"Id"
;
RadGrid1.MasterTableView.Columns.Add(idColumn);
GridBoundColumn realNameColumn =
new
GridBoundColumn();
realNameColumn.DataField =
"RealName"
;
realNameColumn.Display =
true
;
realNameColumn.HeaderText =
"name"
;
realNameColumn.UniqueName =
"RealName"
;
realNameColumn.SortExpression =
"RealName"
;
RadGrid1.MasterTableView.Columns.Add(realNameColumn);
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
IDAL.IBaseRepository<Model.HS_Docter> doctors =
new
DAl.BaseRepository<Model.HS_Docter>();
RadGrid1.DataSource = doctors.GetDataTable(
"select * from Hs_doctor"
);
}
protected
void
RadGrid1_SortCommand(
object
sender, GridSortCommandEventArgs e)
{
IDAL.IBaseRepository<Model.HS_Docter> doctors =
new
DAl.BaseRepository<Model.HS_Docter>();
switch
(e.OldSortOrder)
{
case
GridSortOrder.Ascending:
e.Item.OwnerTableView.DataSource = doctors.GetDataTable(
"select * from hs_doctor"
).Select(
""
, e.CommandArgument.ToString() +
" asc"
);
break
;
case
GridSortOrder.Descending:
e.Item.OwnerTableView.DataSource = doctors.GetDataTable(
"select * from hs_doctor"
).Select(
""
, e.CommandArgument.ToString() +
" desc"
); ;
break
;
}
}