Ejemplo n.º 1
0
        /*-----------------------------------------------------*/

        /*
         *      Method of IPostBackEventHandler that raises change events.
         */
        public void RaisePostBackEvent(string aArgs)
        {
            if (ViewNextPrev != null)
            {
                cPagingCtlEventArgs aEventArgs = new cPagingCtlEventArgs();

                aEventArgs.mAction = aArgs;
                ViewNextPrev(this, aEventArgs);
            }
        }
Ejemplo n.º 2
0
        /*====================================================*/

        protected virtual void OnViewNextPrev(Object aSrc, EventArgs e)
        {
            cPagingCtlEventArgs aArgs = (cPagingCtlEventArgs)e;

            /*
             * Page.Response.Write("Event: " + aArgs.mAction);
             * return;
             */
            int aNextRow;
            int aPrevRow;

            if (CurrentRow + mNumRowsToView >= mTotalRows)
            {
                aNextRow = CurrentRow + (mTotalRows - CurrentRow);
            }
            else
            {
                aNextRow = CurrentRow + mNumRowsToView;
            }

            if (CurrentRow - mNumRowsToView < 1)
            {
                aPrevRow = 1;
            }
            else
            {
                aPrevRow = CurrentRow - mNumRowsToView;
            }


            switch (aArgs.mAction)
            {
            case "First":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, "1");
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, "1", mAnchorName);
                }
                break;

            case "Next":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, aNextRow.ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, aNextRow.ToString(), mAnchorName);
                }
                break;

            case "Prev":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, aPrevRow.ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, aPrevRow.ToString(), mAnchorName);
                }
                break;

            case "Last":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, (mTotalRows - mNumRowsToView + 1).ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, (mTotalRows - mNumRowsToView + 1).ToString(), mAnchorName);
                }
                break;

            case "All":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, "ShowAll");
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, "ShowAll", mAnchorName);
                }
                break;

            case "Current":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, CurrentRow.ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, CurrentRow.ToString(), mAnchorName);
                }
                break;
            }
        }