hello
I created dropdownlist at runtime when a button is clicked.and i palced another button to get the selected text from dynamic dropdownlist.When i try to retrieve the selected text from dropdownlist it gives me the error called object reference not set, following is my code.
TableRow tr;
    TableCell tc;
    DropDownList dp;
    TextBox txt;
    protected void Button1_Click(object sender, EventArgs e)
    {
        int no = int.Parse(TextBox1.Text);
        for (int i = 0; i < no; i++)
        {
            tr = new TableRow();
            tr.BorderStyle = BorderStyle.Groove;
            for (int j = 0; j < 1; j++)
            {
                tc = new TableCell();
                tc.BorderStyle = BorderStyle.Groove;
                dp = new DropDownList();
                //form1.Controls.Add(dp);
                txt = new TextBox();
                dp.Items.Add("hello");
                tc.Controls.Add(dp);
                tc.Controls.Add(txt);
                tr.Cells.Add(tc);
            }
            Table1.Rows.Add(tr);
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text =((DropDownList)this.FindControl("dp")).SelectedItem.Text;
    }