我有一个数据网格,最多可容纳250行,名为Tab order的unquie列。现在我需要 当我点击下一个按钮等等时,它只有5行,剩下的行应该只是可见的。
下面是我的代码片段,当for循环完成时,它会将所有250行数据加载到数据网格中。我需要在这里实现分页概念,任何人都可以帮助指导我走正确的路径
提前致谢
代码段:
private void buttonUpload_Click(object sender, EventArgs e)
{
LoadFile(pdfFullPath, txtPassword.Text);
form = document.getDocumentCatalog().getAcroForm();
java.util.List FieldTypes = form.getFields();
formFieldCount = FieldTypes.size();
totalPages = document.getNumberOfPages();
///cmbpage --- Code pasted here
ArrayList lstPages = new ArrayList();
ArrayList lstTabs = new ArrayList();
ArrayList lstNames = new ArrayList();
ArrayList lstTypes = new ArrayList();
if (formFieldCount != 0)
{
int formField = 1;
for (int i = 0; i < formFieldCount; i++)
{
pdfFields = (PDField)form.getFields().get(i);
fieldName = pdfFields.getFullyQualifiedName();
FieldType type = new FieldType();
if (pdfFields is PDTextbox)
{
type = FieldType.Text;
System.String iAsString = Integer.toString(formField);
pdfFields.setValue(iAsString);
}
else if (pdfFields is PDCheckbox)
{
type = FieldType.CheckBox;
System.String iAsString = Integer.toString(formField);
checkBoxList.Add(fieldName, formField);
}
else if (pdfFields is PDRadioCollection)
{
type = FieldType.RadioButton;
System.String iAsString = Integer.toString(formField);
radioButtonsList.Add(fieldName, formField);
}
else if (pdfFields is PDPushButton)
{
type = FieldType.PushButton;
System.String iAsString = Integer.toString(formField);
}
DataRow newRow = availableFieldsTable.NewRow();
newRow["Field Type"] = type;
newRow["Tab Order"] = formField;
newRow["Field Name"] = fieldName;
availableFieldsTable.Rows.Add(newRow); --> adds up data in data grid
formField++;
}
}
document.save(dummyPDFPath);
}
答案 0 :(得分:0)
DataGrid将如下所示:
<asp:datagrid id=DataGrid1 runat="server" PageSize="5" GridLines="Vertical"
CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None"
BorderColor="#999999" AutoGenerateColumns="False" AllowSorting="True"
DataSource="" Height="64px" Width="120px" AllowPaging="True"
DataMember="MeetingMinutes">
//whatever here..
</Datagrid>
如果您想要下一个和上一个导航,
<PagerSettings Mode="NextPrevious" NextPageText="Next"
PreviousPageText="Previous" />
如果您希望第一个和最后一个标签显示第一页和最后一页,则可以使用此选项。
<PagerSettings FirstPageText="First" LastPageText="Last"
Mode="NextPreviousFirstLast" NextPageText="Next" PreviousPageText="Previous" />
这是一个 执行事件PageIndexChanging后,将为PageIndexChanged分页触发事件。在这种情况下,您可以再次安全地绑定网格以访问第二页。最好缓存用于绑定数据源的数据。
protected void DataGrid_PageIndexChanging(object sender,DataGridPageEventArgs e) { DataGrid.PageIndex = e.NewPageIndex; BindData(); }