2012-05-26 18 views
0

我的Asp页面中有两个下拉框。一旦用户更改了下拉列表中的值,它将触发Autopostback并在标签上显示新的选定值。标签Autopostback abilty

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

我只是想检索这个标签值(动态再现)到另一个文本框。

不幸的是,没有标签的AutoPostBack事件。我该如何克服这一点? 请帮助我。

+0

你为什么将字符串转换为整数,然后返回一个字符串? – woz

+0

这是一些彻头彻尾的糟糕的代码... – dtsg

+0

如果标签的值仅在更改下拉列表的回发时发生变化,为什么不能同时设置文本框的值? – angusf

回答

1

在您上传标签值时更新文本框的值。

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

Textbox1.Text=Label_Value .Tostring();