获取 DropDownList 中 SelectedIndex 处的 SelectedValue?

发布于 2024-10-06 12:23:14 字数 284 浏览 0 评论 0原文

这可能吗?当使用以下代码触发某个事件时,我以编程方式更改选定的索引:

DropDownList.SelectedIndex = DropDownList.SelectedIndex + 1

现在我想通过回发使用 DropDownList 的新 SelectedIndex 中的文本更新相应的文本框。

做到这一点最简单的方法是什么?


我知道如何在 javascript 中做到这一点...我只是想知道我是否可以在后面的 VB 代码中做到这一点。

Is this possible? I programatically change the selected index when a certain event is fired using this code:

DropDownList.SelectedIndex = DropDownList.SelectedIndex + 1

Now I want to update a corresponding textbox with the text that is in the new SelectedIndex of the DropDownList via postback.

What's the easiest way to do this?


I know how I can do this in javascript.... I was just wondering if i could do this in the VB code behind.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疾风者 2024-10-13 12:23:14
TextBox.Text = DropDownList.SelectedValue;

详细了解 ListControl.SelectedValue

TextBox.Text = DropDownList.SelectedValue;

Read more about ListControl.SelectedValue

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文