• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            飛天

            快樂的生活......

             

            .net分頁控件

              public class CPager2 : WebControl
                
            {
                    [Bindable(
            true)]
                    [Category(
            "Appearance")]
                    [DefaultValue(
            "")]
                    [Localizable(
            true)]
                    public CPager2()
                    
            {
                        FirstImage 
            = "../image/backward24.gif";
                        PreviousImage 
            = "../image/back24.gif";
                        NextImage 
            = "../image/next24.gif";
                        EndImage 
            = "../image/forward24.gif";

                        FirstImage2 
            = "../image/backward24-gray.gif";
                        PreviousImage2 
            = "../image/back24-gray.gif";
                        NextImage2 
            = "../image/next24-gray.gif";
                        EndImage2 
            = "../image/forward24-gray.gif";
                        CreatePage();
                    }




                    #region 創(chuàng)始
                    private 
            void CreatePage()
                    
            {
                        
            this.CssClass = "Page2";

                        
                        
            //第一頁
                        ImageButton FirstBtn = new ImageButton();
                        FirstBtn.ID 
            = "First";
                        FirstBtn.CommandName 
            = "First";
                        FirstBtn.CssClass 
            = "PageButton";
                        FirstBtn.ImageUrl 
            = FirstImage;
                        
            this.Controls.Add(FirstBtn);
                        FirstBtn.Enabled 
            = false;
                        FirstBtn.Command 
            += new CommandEventHandler(Button_Command);

                        ImageButton preBtn 
            = new ImageButton();
                        preBtn.ID 
            = "Previous";
                        preBtn.CommandName 
            = "Previous";
                        preBtn.CssClass 
            = "PageButton";
                        preBtn.ImageUrl 
            = PreviousImage;
                        
            this.Controls.Add(preBtn);
                        preBtn.Enabled 
            = false;
                        preBtn.Command 
            += new CommandEventHandler(Button_Command);

                        
            //----------------------------------------------------------------------------------------------------------------
                        //下一頁
                        ImageButton nextBtn = new ImageButton();
                        nextBtn.ID 
            = "Next";
                        nextBtn.CommandName 
            = "Next";
                        nextBtn.CssClass 
            = "PageButton";
                        
            this.Controls.Add(nextBtn);
                        nextBtn.ImageUrl 
            = NextImage;
                        nextBtn.Command 
            += new CommandEventHandler(Button_Command);

                        ImageButton EndBtn 
            = new ImageButton();
                        EndBtn.ID 
            = "End";
                        EndBtn.CommandName 
            = "End";
                        EndBtn.CssClass 
            = "PageButton";
                        EndBtn.ImageUrl 
            = EndImage;
                        
            this.Controls.Add(EndBtn);
                        EndBtn.Command 
            += new CommandEventHandler(Button_Command);

                        DropDownList drp 
            = new DropDownList();
                        drp.AutoPostBack 
            = true;
                        drp.ID 
            = "ddlGo";
                        drp.CssClass 
            = "PageGo";
                        
            this.Controls.Add(drp);
                        drp.SelectedIndexChanged 
            += new EventHandler(drp_SelectedIndexChanged);


                    }


                    #region Command
                    
            void Button_Command(object sender, CommandEventArgs e)
                    
            {
                        PageChangedEventArgs ex 
            = new PageChangedEventArgs();
                        ex.OldPageIndex 
            = PageIndex;

                        
            switch (e.CommandName)
                        
            {
                            
            case "First":
                                PageIndex 
            = 0;
                                
            break;
                            
            case "Next":
                                PageIndex 
            = PageIndex + 1;
                                
            break;
                            
            case "Previous":
                                PageIndex 
            = PageIndex - 1;
                                
            break;
                            
            case "End":
                                PageIndex 
            = PageTotal - 1;
                                
            break;
                        }


                        PageButtonStatus();

                        ex.NewPageIndex 
            = PageIndex;
                        OnPageIndexChange(ex);

                    }

                    #endregion
                    #region 設(shè)置狀態(tài)
                    private 
            void PageButtonStatus()
                    
            {
                        
            if (PageIndex <= 0)
                        
            {
                            ((ImageButton)
            this.FindControl("First")).Enabled = false;
                            ((ImageButton)
            this.FindControl("Previous")).Enabled = false;

                            ((ImageButton)
            this.FindControl("First")).ImageUrl = FirstImage2;
                            ((ImageButton)
            this.FindControl("Previous")).ImageUrl = PreviousImage2;
                        }

                        
            else
                        
            {
                            ((ImageButton)
            this.FindControl("First")).Enabled = true;
                            ((ImageButton)
            this.FindControl("Previous")).Enabled = true;

                            ((ImageButton)
            this.FindControl("First")).ImageUrl = FirstImage;
                            ((ImageButton)
            this.FindControl("Previous")).ImageUrl = PreviousImage;
                        }

                        
            if (PageIndex >= PageTotal - 1)
                        
            {
                            ((ImageButton)
            this.FindControl("Next")).Enabled = false;
                            ((ImageButton)
            this.FindControl("End")).Enabled = false;

                            ((ImageButton)
            this.FindControl("Next")).ImageUrl = NextImage2;
                            ((ImageButton)
            this.FindControl("End")).ImageUrl = EndImage2;
                        }

                        
            else
                        
            {
                            ((ImageButton)
            this.FindControl("Next")).Enabled = true;
                            ((ImageButton)
            this.FindControl("End")).Enabled = true;

                            ((ImageButton)
            this.FindControl("End")).ImageUrl = EndImage;
                            ((ImageButton)
            this.FindControl("Next")).ImageUrl = NextImage;
                        }


                        DropDownList ddlGo 
            = (DropDownList)FindControl("ddlGo");
                        ddlGo.Items.Clear();
                        
            for (int i = 1; i <=PageTotal; i++)
                        
            {
                            ddlGo.Items.Add(i.ToString());
                        }

                        
            if(PageTotal>0)
                            ddlGo.SelectedIndex 
            = PageIndex;
                    }

                    #endregion

                    
            void drp_SelectedIndexChanged(object sender, EventArgs e)
                    
            {
                        PageChangedEventArgs ex 
            = new PageChangedEventArgs();
                        ex.OldPageIndex 
            = PageIndex;
                        DropDownList ddlGo 
            = (DropDownList)FindControl("ddlGo");
                        PageIndex 
            = ddlGo.SelectedIndex;
                        PageButtonStatus();

                        ex.NewPageIndex 
            = PageIndex;
                        OnPageIndexChange(ex);

                    }

                    #endregion

                    #region 屬性

                    [Description(
            "當(dāng)前頁")]
                    public 
            int PageIndex
                    
            {
                        get
                        
            {
                            
            int temp = 0;
                            
            if (ViewState["PageIndex"!= null)
                                temp 
            = Convert.ToInt32(ViewState["PageIndex"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "PageIndex"= value;
                        }

                    }


                    
            /// <summary>
                    /// 設(shè)置總頁數(shù)
                    /// </summary>
                    [Description("總頁數(shù)")]
                    public 
            int PageTotal
                    
            {
                        get
                        
            {
                            
            if (ViewState["PageTotal"!= null)
                                
            return Convert.ToInt32((ViewState["PageTotal"]));
                            
            else
                                
            return 0;
                        }

                        set
                        
            {
                            ViewState[
            "PageTotal"= value;
                            
                            
            this.PageButtonStatus();

                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "第一頁圖片")]
                    public string FirstImage
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["FirstImage"!= null)
                                temp 
            = Convert.ToString(ViewState["FirstImage"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "FirstImage"= value;
                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "上一頁圖片")]
                    public string PreviousImage
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["PriviousImage"!= null)
                                temp 
            = Convert.ToString(ViewState["PriviousImage"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "PriviousImage"= value;
                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "下一頁圖片")]
                    public string NextImage
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["NextImage"!= null)
                                temp 
            = Convert.ToString(ViewState["NextImage"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "NextImage"= value;
                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "末頁圖片")]
                    public string EndImage
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["EndImage"!= null)
                                temp 
            = Convert.ToString(ViewState["EndImage"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "EndImage"= value;
                        }

                    }


                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "第一頁圖片")]
                    public string FirstImage2
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["FirstImage2"!= null)
                                temp 
            = Convert.ToString(ViewState["FirstImage2"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "FirstImage2"= value;
                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "上一頁圖片")]
                    public string PreviousImage2
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["PriviousImage2"!= null)
                                temp 
            = Convert.ToString(ViewState["PriviousImage2"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "PriviousImage2"= value;
                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "下一頁圖片")]
                    public string NextImage2
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["NextImage2"!= null)
                                temp 
            = Convert.ToString(ViewState["NextImage2"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "NextImage2"= value;
                        }

                    }

                    [Category(
            "設(shè)置圖片")]
                    [Description(
            "末頁圖片")]
                    public string EndImage2
                    
            {
                        get
                        
            {
                            string temp 
            = "";
                            
            if (ViewState["EndImage2"!= null)
                                temp 
            = Convert.ToString(ViewState["EndImage2"]);
                            
            return temp;
                        }

                        set
                        
            {
                            ViewState[
            "EndImage2"= value;
                        }

                    }


                    #endregion

                    #region 事件
                    public delegate 
            void PageChangedEventHandler(object sender, PageChangedEventArgs e);
                    public event PageChangedEventHandler PageIndexChanged;
                    protected virtual 
            void OnPageIndexChange(PageChangedEventArgs e)
                    
            {
                        
            if (PageIndexChanged != null)
                            PageIndexChanged(
            this, e);
                    }




                   #endregion

                }

            posted on 2008-03-23 14:58 飛天 閱讀(342) 評論(0)  編輯 收藏 引用 所屬分類: Web

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(2)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            Blogs

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            丁香久久婷婷国产午夜视频| 狠狠色丁香婷婷久久综合不卡| 天天综合久久久网| 国内精品久久久久影院薰衣草 | 久久免费大片| 一本色道久久88精品综合| 久久久久久久亚洲Av无码| 亚洲国产精品久久久久婷婷老年| 偷窥少妇久久久久久久久| 久久99精品久久久久子伦| 久久综合久久性久99毛片| 伊人色综合久久天天人手人婷| 日本一区精品久久久久影院| 久久这里有精品| 精品久久久无码中文字幕天天| 亚洲第一极品精品无码久久| 大美女久久久久久j久久| 亚洲中文字幕无码久久2017| 久久久黄片| 国产午夜免费高清久久影院 | 77777亚洲午夜久久多人| 97久久超碰成人精品网站| 2021少妇久久久久久久久久| 久久九九久精品国产| 亚洲国产成人久久精品动漫| 亚洲v国产v天堂a无码久久| 久久r热这里有精品视频| 久久午夜免费视频| 亚洲欧美日韩久久精品| 日韩一区二区久久久久久 | 国产精品久久久99| 久久99精品国产麻豆宅宅| 精品综合久久久久久888蜜芽| 久久久久久国产精品美女| 亚洲精品99久久久久中文字幕 | 久久精品国产AV一区二区三区| 久久99精品久久久久久不卡| 国内精品久久久久久不卡影院| 伊人久久综合热线大杳蕉下载| 久久九九亚洲精品| 66精品综合久久久久久久|