使TextBox与DropDownList的SelectedValue同步 [英] Make a TextBox sync with SelectedValue of a DropDownList

查看:75
本文介绍了使TextBox与DropDownList的SelectedValue同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有以下ItemTemplate的FormView.如何使文本框反映所选广告系列的正确TypeName?

I have a FormView with the following ItemTemplate. What do I have to do to make the Textbox reflect the correct TypeName for the selected campaign?

<asp:Label ID="campaignNameLabel" runat="server" AssociatedControlID="campaignList">Campaign Name: </asp:Label>
<asp:DropDownList ID="campaignList" runat="server" Width="200px" AutoPostBack="True" DataSourceID="campaignsSqlDataSource" DataValueField="CampaignID" DataTextField="Name" SelectedValue='<%# Bind("CampaignID") %>'>
</asp:DropDownList>
<asp:Label ID="campaignTypeLabel" runat="server">Campaign Type: </asp:Label>
<asp:TextBox ID="campaignTypeText" runat="server" Width="150px" Text='<%# Eval("TypeName") %>'></asp:TextBox>

推荐答案

能否详细说明您想要的内容要做.
如果我没看错,则希望在文本框中查看组合框的选定值.

为此,请在组合框的选定索引更改事件中填写以下代码.
campaignTypeText.Text = campaignlist.text;


如果要在键入组合框值时更改文本框值,则可以将事件放置在组合框文本更改事件中..
can you elaborate more on what you want to do.
if i am not wrong, you want the selected value of the combo box to be viewed on the textbox.

for this, fill the following code in the selected index change event of the combo box.
campaignTypeText.Text = campaignlist.text;


if you want to change the textbox value as u type in the combo box value then u can place the event in the combobox text change event..


这篇关于使TextBox与DropDownList的SelectedValue同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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