I have a custom control which encapsulates a dropdownlist and label. when you select an item from the dropdownlist it should autopostback and change the lable text. But postback (selectionchanged) event is not working at all. Here is my code.
protected override void RenderContents(HtmlTextWriter output) { this.buildControl(output); }
private void buildControl(HtmlTextWriter output) { Table currencyConverterTable = new Table(); // add a label
// here I am adding a dropdownlist dropdownlist currencySelector= new dropdownlist(); currencySelector.DataSource = mydatasource; currencySelector.DataTextField = "CurrencyCode"; currencySelector.DataValueField = "id"; currencySelector.DataBind(); currencySelector.AutoPostBack = true; currencySelector.SelectedIndexChanged += new EventHandler(OnSelectedChanged);
// add this dropdownlist to the table
// now render it currencyConverterTable.RenderControl(output); }
Shouldn't OnSelectedChanged event be fired?
Thanks,
Toby