0

I have three DropdownList named

  1. drpUniversity
  2. drpFaculty
  3. drpSupervisor

in my page.
In drpUniversity has a list of University and in last index has Others if the listed Universities are not sufficient for users.
Like as:

  1. American University,
  2. George Washington University,
  3. Florida Hospital College of Health Sciences
  4. and Others

Now, in the drpUniversity_SelectedIndexChange event I have add a Label and a TextBox when the user select the Others (or last index).

My Code:

 protected void drpUniversity_SelectedIndexChanged(object sender, EventArgs e)
 {
        if (IsPostBack)
        {
            if (drpUniversity.SelectedItem.Value.ToString() == "Others".ToString())
            {
                int rowcount = mytable.Rows.Count;
                HtmlTableRow row = new HtmlTableRow();
                row.ID = "tbl_row" + (rowcount + 1);
                HtmlTableCell cell1 = new HtmlTableCell();
                cell1.ID = "tbl_cell1" + (rowcount + 1);
                HtmlTableCell cell2 = new HtmlTableCell();
                cell2.ID = "tbl_cell2" + (rowcount + 1);
                cell1.Attributes["class"] = "contact";
                cell2.Attributes["class"] = "contact";
                TextBox tb = new TextBox();
                tb.ID = "tbQty" + (rowcount + 1);
                tb.Width = 276;
                Label lblotherUniver = new Label();
                lblotherUniver.ID = "lbluniversity";
                lblotherUniver.Text = "University Name";
                cell2.Controls.Add(lblotherUniver);
                cell1.Controls.Add(tb);
                row.Cells.Add(cell2);
                row.Cells.Add(cell1);
                mytable.Rows.Insert(8, row);
                mytable.DataBind();
            }
        }
  }

But, the problem is when its creating a TextBox and a Lable then the other DropDownList named drpFaculty's and drpSupervisor's SelectedIndexChange events are not working.

In my drpSupervisor SelectedIndexChange event have This Code:

protected void drpSupervisor_SelectedIndexChanged(object sender, EventArgs e)
{
     txtSupervisorEmail.Text = drpSupervisor.SelectedItem.Value.ToString();
     txtSupervisorEmail.Visible = true;
}

This is not working after Select Others from drpUniversity.
Otherwise this is working.
Please help me to solve this problem.

शेखर
  • 17,412
  • 13
  • 61
  • 117

1 Answers1

0

Seems there is a javascript error in your code. Please check javascript error console in broswer.

Ravi
  • 310
  • 3
  • 11