asp.net自定义分页控件示例(2)

default:
                    {
                        _gv.PageIndex = Convert.ToInt32(arg);
                        break;
                    }
            }
            PageButtonClick(sender, e);

}

public void SetPageButton()
        {
            if (_gv.PageIndex == 0)
            {
                LinkFirst.Enabled = false;
                LinkPrevious.Enabled = false;


                LinkFirst.Style["color"] = "gray";
                LinkPrevious.Style["color"] = "gray";

object s = LinkFirst.Style.Keys;
                if (_gv.PageCount > 1)
                {
                    LinkNext.Enabled = true;
                    LinkLast.Enabled = true;
                    txtpage.Enabled = true;
                    txtpage.Enabled = true;
                    LinkNext.Style["color"] = "#000";
                    LinkLast.Style["color"] = "#000";
                    txtpage.Style["readonly"] = "false";
                }
                else
                {
                    LinkNext.Enabled = false;
                    LinkLast.Enabled = false;
                    txtpage.Enabled = false;
                    LinkNext.Style["color"] = "gray";
                    LinkLast.Style["color"] = "gray";
                    txtpage.Style["readonly"] = "true";//background-color
                }
            }
            else if (_gv.PageIndex == _gv.PageCount - 1)
            {
                LinkFirst.Enabled = true;
                LinkPrevious.Enabled = true;
                LinkNext.Enabled = false;
                LinkLast.Enabled = false;
                LinkFirst.Style["color"] = "#000";
                LinkPrevious.Style["color"] = "#000";
                LinkNext.Style["color"] = "gray";
                LinkLast.Style["color"] = "gray";
            }
            else
            {
                LinkFirst.Enabled = true;
                LinkPrevious.Enabled = true;
                LinkNext.Enabled = true;
                LinkLast.Enabled = true;
                LinkFirst.Style["color"] = "#000";
                LinkPrevious.Style["color"] = "#000";
                LinkNext.Style["color"] = "#000";
                LinkLast.Style["color"] = "#000";
            }
        }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzsjd.html