[英]populate textbox from dropdown list value - asp.net with vb.net
I am trying to get an "onchange" (not sure still new to asp) event to enter the select value text into a text box . 我正在尝试获取一个“ onchange”(不确定还是asp的新手)事件,以将选择值文本输入到文本框中。 I can seem to call the function.
我似乎可以调用该函数。
here is my code: 这是我的代码:
<asp:DropDownList ID="ownerdpdnlst" runat="server" ontextChanged="execvalchanged" >
<asp:ListItem Value="(Choose One)">Choose one...</asp:ListItem>
<asp:ListItem Value="name1">name1</asp:ListItem>
<asp:ListItem Value="name2">name2</asp:ListItem>
<asp:ListItem Value="name3">name3</asp:ListItem>
<asp:ListItem Value="name4">name4</asp:ListItem>
<asp:ListItem Value="name5">name5</asp:ListItem>
</asp:DropDownList>
</asp:TableCell>
here is my vb.net code 这是我的vb.net代码
<script runat=server>
Public Sub execvalchanged(Sender As Object, e As EventArgs) Handles ownerdpdnlst.SelectedIndexChanged
executortxtbx.Text = ownerdpdnlst.SelectedValue
MsgBox(ownerdpdnlst.SelectedValue)
End Sub
</SCRIPT>
any ideas? 有任何想法吗?
In aspx You define OnTextChanged but in code behind SelectedIndexChanged. 在aspx中,您定义OnTextChanged,但在SelectedIndexChanged之后的代码中。 In aspx, Instead ontextChanged="execvalchanged" use OnSelectedIndexChanged="execvalchanged"– nelekSep 12 at 6:32
在aspx中,改为使用onSelectedIndexChanged =“ execvalchanged” – nelekSep 12 at 6:32
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.