label Autopostback abilty
-
11-06-2021 - |
Question
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
OTHER TIPS
string Label_Value =Convert.ToString(Convert.Int32(DropDownList1.SelectedValue.ToString())+Convert.Int32(DropDownList2.SelectedValue.ToString()));
Textbox1.Text=Label_Value .Tostring();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow