0

I have a Data Grid holding upto 250 rows with unquie column called Tab order. Now i need to have only 5 rows and remaining rows should only be visbile when i click on next button and so on ..

below is my code snippet, when the for loop is completed it will load up all 250 row data into data grid .. i need to implement paging concept here can any one help out in guiding me in right path

Thanks in advance

code snippet :

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);
        }
4

1 に答える 1

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 ページングに対してイベントが発生します。このイベントでは、グリッドを再度安全にバインドして、2 番目のページにアクセスできます。データ ソースのバインドに使用されるデータをキャッシュすることは、常に望ましいことです。

protected void DataGrid_PageIndexChanging(オブジェクト送信者、DataGridPageEventArgs e) { DataGrid.PageIndex = e.NewPageIndex; BindData(); }

于 2013-02-22T07:02:08.237 に答える