更改从使用面板显示的代码背后生成的按钮的样式

时间:2018-12-02 03:24:24

标签: c# asp.net twitter-bootstrap pagination paging

这是我的代码,用于在asp.net中生成分页按钮,但想更改按钮的样式以匹配Bootstrap的分页类。由于按钮是由后面的代码生成的,我该怎么做?这是C#背后的代码:

con.getConnexion()

这是前端中的简单面板组件:

private void AddpagingButton()
        {
            // this method for generate custom button for Custom paging in Gridview
            int totalRecord = 0;
            int noofRecord = 0;
            totalRecord = ViewState["TotalRecord"] != null ? (int)ViewState["TotalRecord"] : 0;
            noofRecord = ViewState["NoOfRecord"] != null ? (int)ViewState["NoOfRecord"] : 0;
            int pages = 0;
            if (totalRecord >0 && noofRecord > 0)
            {
                // Count no of pages 
                pages = (totalRecord / noofRecord) + ((totalRecord % noofRecord) > 0 ? 1 : 0);
                for (int i = 0; i < pages; i++)
                {
                    Button b = new Button();
                    b.Text = (i + 1).ToString();
                    b.CommandArgument = (i + 1).ToString();
                    b.ID = "Button_" + (i + 1).ToString();
                    b.Click += new EventHandler(this.b_click);
                    Panel1.Controls.Add(b);
                }
            }

        }

0 个答案:

没有答案