示例#1
0
        //EnableSortingAndPagingCallbacks to minimize postbacks?
        private void SortGridView(string sortExpression, string direction)
        {
            GridBAL booksLogic = new GridBAL();
            //DataView myDataView = new DataView(booksLogic.GetData());
            DataView myDataView = new DataView();

            if (ViewState["username"].ToString() == "")
            {
                if (Convert.ToByte(ViewState["filter"]) == 1)
                {
                    myDataView = booksLogic.GetData(Convert.ToByte(ViewState["filter"])).AsDataView();
                }
                else
                {
                    myDataView = booksLogic.GetData().AsDataView();
                }
            }
            else
            {
                myDataView = booksLogic.GetDataByUsername(ViewState["username"].ToString()).AsDataView();
            }


            myDataView.Sort      = sortExpression + direction;
            BooksGrid.DataSource = myDataView;
            BooksGrid.DataBind();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //BooksBAL booksLogic = new BooksBAL();
            GridBAL booksLogic = new GridBAL();

            BooksGrid.DataSource = booksLogic.GetData();
            BooksGrid.DataBind();
        }
示例#3
0
        protected void AvailableBooks_Click(object sender, EventArgs e)
        {
            ViewState["filter"]   = 1;
            ViewState["username"] = "";
            GridBAL booksLogic = new GridBAL();

            BooksGrid.DataSource = booksLogic.GetData(Convert.ToByte(ViewState["filter"]));
            BooksGrid.DataBind();
        }