Click here to Skip to main content
14,870,729 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have three DropdownList named drpUniversity, drpFaculty and 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: American University, George Washington University,
Florida Hospital College of Health Sciences 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";
                    mytable.Rows.Insert(8, row);

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. How, can I solve this problem?
"Is not working" is not informative.
UL UL ALBAB 18-Feb-13 1:31am
means what ?
Richard C Bishop 18-Feb-13 15:27pm
Whats the point of using a ToString() at the end of a string in quotes?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900