DataGrid的 OnSortCommand=" SortingPage" AllowSorting="True"
public void BindShelf()
![]() {
![]()
//连结数据库c01a43 View CurrentShelfUse (
![]()
string string1 = ConfigurationSettings.AppSettings["AMHSWeb"];
SqlConnection cn = new SqlConnection (string1);
string strquerystor = "select STKName , ShelfType , 已使用格位数+剩余格位数 as 总格位数, " +
"已使用格位数 as 已使用, 剩余格位数 as 未使用 from CurrentShelfUse ";
SqlDataAdapter adapter = new SqlDataAdapter(strquerystor ,cn);
DataSet MyDataSet = new DataSet();
adapter.Fill(MyDataSet , "CurrentShelfUse" );
DataView source = new DataView (MyDataSet.Tables["CurrentShelfUse"]);
string SortExpression = dgShelf.Attributes["SortExpression"];
string SortDirection = dgShelf.Attributes["SortDirection"];
source.Sort = SortExpression + " " + SortDirection;
dgShelf.DataSource = source;
dgShelf.DataBind();
cn.Close();
}
![]()
public void SortingPage( Object sender , System.Web.UI.WebControls.DataGridSortCommandEventArgs e )
![]() {
// 用于更改排序方向 ASC 与 DESC 相互转换
string SortExpression = e.SortExpression.ToString();
string SortDirection = "ASC";
if(SortExpression == dgShelf.Attributes["SortExpression"])
![]() {
![]()
SortDirection = (dgShelf.Attributes["SortDirection"].ToString() == SortDirection ? "DESC" : "ASC");
![]()
}
![]()
dgShelf.Attributes["SortExpression"] = SortExpression;
![]()
dgShelf.Attributes["SortDirection"] = SortDirection;
BindShelf();
![]()
![]()
![]()
}
" AllowSorting="True"
public void BindShelf()
![]() {
![]()
//连结数据库c01a43 View CurrentShelfUse (
![]()
string string1 = ConfigurationSettings.AppSettings["AMHSWeb"];
SqlConnection cn = new SqlConnection (string1);
string strquerystor = "select STKName , ShelfType , 已使用格位数+剩余格位数 as 总格位数, " +
"已使用格位数 as 已使用, 剩余格位数 as 未使用 from CurrentShelfUse ";
SqlDataAdapter adapter = new SqlDataAdapter(strquerystor ,cn);
DataSet MyDataSet = new DataSet();
adapter.Fill(MyDataSet , "CurrentShelfUse" );
DataView source = new DataView (MyDataSet.Tables["CurrentShelfUse"]);
string SortExpression = dgShelf.Attributes["SortExpression"];
string SortDirection = dgShelf.Attributes["SortDirection"];
source.Sort = SortExpression + " " + SortDirection;
dgShelf.DataSource = source;
dgShelf.DataBind();
cn.Close();
}
![]()
public void SortingPage( Object sender , System.Web.UI.WebControls.DataGridSortCommandEventArgs e )
![]() {
// 用于更改排序方向 ASC 与 DESC 相互转换
string SortExpression = e.SortExpression.ToString();
string SortDirection = "ASC";
if(SortExpression == dgShelf.Attributes["SortExpression"])
![]() {
![]()
SortDirection = (dgShelf.Attributes["SortDirection"].ToString() == SortDirection ? "DESC" : "ASC");
![]()
}
![]()
dgShelf.Attributes["SortExpression"] = SortExpression;
![]()
dgShelf.Attributes["SortDirection"] = SortDirection;
BindShelf();
![]()
![]()
![]()
}
posted on
2006-08-25 22:24
^Eric^
阅读( 414)
评论()
收藏
举报
|