这是我的代码,用于在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);
}
}
}