Hi Guys,

I have written a fragment of code that basically displays the text box if the drop down box (selected item.value) = 1 or 2 otherwise it will not display the text box.
it works fine for the static drop down box


but same thing is not working if the drop down list is dynamic. It always post back the first value. Can any one kindly explain me what I am missing here??

here is my code....................

private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)

{

string GetDataFromDD;

if (!IsPostBack)

{

GetDataFromDD = DropDownList1.SelectedItem.Value.ToString();

}

else

{

GetDataFromDD = DropDownList1.SelectedItem.Value.ToString();

}


Response.Write(GetDataFromDD);

switch(GetDataFromDD)

{

case "1":

TextBox1.Visible = true;

break;

case "2":

TextBox1.Visible = true;

break;

case "3":

TextBox1.Visible = false;

break;

case "4":

TextBox1.Visible = false;

break;


}


}

Thanks in advance,

dummy