Adding radiogroup, buttons and controls in asp.net using c#
<p>Here is the complete code.   I want to display a radiogroup  when I select 1 in the dropdown list box. I get the error 'System.Web.HttpException: Control 'RadioButton1' of type 'RadioButton' must be placed inside a form tag with runat=server'. </p>

<pre><code>         namespace HostelRoomManagement 
         {
          public partial class WebForm1 : System.Web.UI.Page
          {
          protected void Page_Load(object sender, EventArgs e)
           {

            }



    protected void Button1_Click(object sender, EventArgs e)
    {

    }

    protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
    {

        if (DropDownList1.SelectedValue == "1")
        {
            RadioButton rb1 = new RadioButton();
            rb1.ID = "RadioButton1";
            rb1.Text = "C block";
            rb1.GroupName = "BlockGroup";
            RadioButton rb2 = new RadioButton();
            rb2.ID = "RadioButton2";
            rb2.Text = "C block";
            rb2.GroupName = "BlockGroup";
            Page.Controls.Add(rb1);
            Page.Controls.Add(rb2);



        }


    }

    protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
    {

    }


}
}
</code></pre>

<p>I get the error 'System.Web.HttpException: Control 'RadioButton1' of type 'RadioButton' must be placed inside a form tag with runat=server'</p>
