How do I retrieve all data from Firebase realtime database in c# asp.net in aspx page table?

Viewed 1157

Here's the code:

protected async void Page_Load(object sender, EventArgs e)
        {
            int i = 1;
            client = new FireSharp.FirebaseClient(config);


            for (int row = 0; row < 2; row++)
            {
                FirebaseResponse resp = await client.GetTaskAsync("Member/" + i);
                Data obj = resp.ResultAs<Data>();
                TableRow newRow = new TableRow();
                Table2.Controls.Add(newRow);
                for (int column = 0; column < 7; column++)
                {
                    if (column == 0)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = i.ToString(); ;
                        newRow.Controls.Add(newCell);
                    }

                    else if (column== 1)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = obj.name;
                        newRow.Controls.Add(newCell);
                    }

                    else if (column == 2)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = obj.contact;
                        newRow.Controls.Add(newCell);
                    }

                    else if (column == 3)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = obj.cnic;
                        newRow.Controls.Add(newCell);
                    }

                    else if (column == 4)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = obj.address;
                        newRow.Controls.Add(newCell);
                    }

                    else if (column == 5)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = obj.othercontact;
                        newRow.Controls.Add(newCell);
                    }

                    else if (column == 6)
                    {
                        TableCell newCell = new TableCell();
                        newCell.Text = obj.vehicle;
                        newRow.Controls.Add(newCell);
                    }
                }
                i++;
            }
        }

So here is my code for retrieval of data, but I have to change value of row in for loop manually every time when new data is inserted in firebase database, I just need to count the data and then show it in table or gridview in aspx page... How do I get all data from firebase database and show it in the table?

0 Answers
Related