venus najad

venus najad

  • 1k
  • 414
  • 29k

how to fill a page in matrix form & how to allow paging from Gridview

Sep 3 2024 3:37 AM

hello everyone
 i have a gridview with 9000 rows. i fill my page dynamically in matrix form, withy 3000 rows and 3 columns, but i have 2 issues:
1. 
Panel[,]  panels=new Panel [(2000 / 3) + 1, 3];
Table mytable=new Table();
....
mytable.Controls.Add(trow_7);
panels[row, col] = new Panel();
panels[row, col].Controls.Add(mytable);
this.form2.Controls.Add(panels[row, col]);
            col++;
            if (col == 3)
            {
                row++;             
                    col = 0;
            }
the problem is that the page is not filled in matrixform, only rows with one column??!! 
when i use            form2.Controls.Add(panels[row, col]); and i use 
this.Controls.Add(form2);        after the loop for gridview, the page is empty???!!! may i ask you please tell me what is my misstake, thanks.

2.
i need that my page fills with 3 columns and 3 rows. i need the next page be created automatically, but it doesn't ??!! i use:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id" AllowPaging="True" 
                  BackColor="White"  BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4"  
                  CellSpacing="4" ForeColor="Black" GridLines="Vertical" Visible="false" AllowSorting="True" 
                  PageSize="3" OnPageIndexChanging="GridView1_PageIndexChanging"> 
        <PagerSettings Mode="NumericFirstLast" FirstPageText="First" NextPageText="Next" LastPageText="Last" />


 in code behind i use: 


protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            BindGridView(0);

        }

but it shows only the three first members in gridview, and no next page is created??!! how should i solve this?

please help me, very kind regards


Answers (1)