Search code examples
c#asp.netautopostback

label Autopostback abilty


I have Two Dropdown boxs in my Asp page. Once user changed the value one of a dropdown, it fire the Autopostback and display a new selected value on a label.

label.text = Convert.ToString(Convert.Int32(DropDownList1.SelectedValue.ToString())+Convert.Int32(DropDownList2.SelectedValue.ToString()));

I just want to retrieve this label value (which reproduce dynamically ) to another text box.

Unfortunatly there is no event called AutoPostBack for labels. How can I overcome this? please help me.


Solution

  • Update the textbox value at the time you are upadting the label value.

    label.text = Convert.ToString(Convert.Int32(DropDownList1.SelectedValue.ToString())+Convert.Int32(DropDownList2.SelectedValue.ToString()));
    textBox.text = label.text