我有一个下拉列表,我正在使用Visual Studio扩展程序填充,我想从该下拉列表中填充文本框?我怎么做 ? [英] i have a dropdownlist which i am populating using visual studio extender i want to populate a textbox from that dropdown list? how do i do that ?

查看:170
本文介绍了我有一个下拉列表,我正在使用Visual Studio扩展程序填充,我想从该下拉列表中填充文本框?我怎么做 ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉列表,我正在使用Visual Studio扩展程序进行填充,我想从该下拉列表中填充文本框吗?我该怎么做?

i have a dropdownlist which i am populating using visual studio extender i want to populate a textbox from that dropdownlist? how do i do that ?

推荐答案

以上解决方案中所说的都是正确的,但是由于我们拥有所需的值,因此无需再访问数据库了.下拉列表本身.

因此可以像这样修改下拉列表事件处理程序.


What ever said in the above solution is correct but there is noneed of accessing the database one more as we are having the required value in the dropdown list itself.

so the dropdown list event handler can be modified like this.


protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
       TextBox1.Text=DropDownList1.SelectedItem.Value.ToString();
    }


如果您需要有关用户选择的更多信息,则可以再访问一次数据库.


If you are need of more information related to the user selection then you can access the database one more time.


这篇关于我有一个下拉列表,我正在使用Visual Studio扩展程序填充,我想从该下拉列表中填充文本框?我怎么做 ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆