그래서 그리드 열 정렬을 처리하기 위해 많은 페이지에서 사용하는 인터넷에서 "빌린"방법이 있습니다.도우미 클래스의 참조 세션
private string GetSortDirection(string column)
{
// By default, set the sort direction to ascending.
string sortDirection = "ASC";
// Retrieve the last column that was sorted.
string sortExpression = ViewState["SortExpression"] as string;
if (sortExpression != null)
{
// Check if the same column is being sorted.
// Otherwise, the default value can be returned.
if (sortExpression == column)
{
string lastDirection = ViewState["SortDirection"] as string;
if ((lastDirection != null) && (lastDirection == "ASC"))
{
sortDirection = "DESC";
}
}
}
// Save new values in ViewState.
ViewState["SortDirection"] = sortDirection;
ViewState["SortExpression"] = column;
return sortDirection;
}
는 지금은 잘 작동하지만, 슬프게도, 나는 그것이 viewstate가를 참조하므로에서 호출 할 모든 페이지에 복사해야합니다. 그래서 그것을 도우미 클래스로 옮기고 대신 세션 상태로 저장하려고합니다. 그러나 도우미 클래스에서 상태를 참조 할 수는 없습니다.
도움말 클래스에서 세션에 액세스 할 수있는 방법이 있습니까? 세션 상태를 참조로 전달할 수 있습니까?
기본 클래스를 만드는 방법에 대해 살펴 보았습니다. 간단하고 간단했습니다. – Limey
OO 디자인을위한 만세! – wsanville