I am adding data in datagridview dynamically in page load event. But I am getting an error that says that the index was out of range. ("Must be non-negative and less than the size of the collection.parameter name in datagridview.")
The following is the code:
dataGridView1.Rows.Add();
dataGridView1.Rows[0].Cells[0].Value = "Basic";
dataGridView1.Rows[0].Cells[1].Value = "Basic";
dataGridView1.Rows[1].Cells[0].Value = "PDALLW";
dataGridView1.Rows[1].Cells[1].Value = "Professional Development Allow";
dataGridView1.Rows[2].Cells[0].Value = "BPAllw";
dataGridView1.Rows[2].Cells[1].Value = "Business Promotion Allowance";