asp .net代码将数据库表值带到文本框中 [英] asp .net code to bring the database table value to the text box

查看:81
本文介绍了asp .net代码将数据库表值带到文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,我需要用vb中的asp .net编码,如果我选择一个或多个下拉列表框,则文本还应显示与该下拉列表框相关的数据库中的值,你能帮我吗

sir i need the asp .net coding in vb that if i select the one or more drop down list box the text also should display the values from the database as related to that drop down list box could u help me

推荐答案

像这样尝试
在aspx页面中创建一个下拉菜单,并创建SelectedIndexChanged
该下拉列表的事件,然后将dropdownlist的值分配给文本框
喜欢

try like this
create a drop down in aspx page and create a SelectedIndexChanged
event for that dropdownlist then assign dropdownlist value to textbox
like

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
       TextBox1.Text = DropDownList1.SelectedItem.Text
   End Sub


并为dropdownlist设置autopostback = true
喜欢


and set autopostback= true for dropdownlist
like

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
            <asp:ListItem>12</asp:ListItem>
            <asp:ListItem>3</asp:ListItem>
            <asp:ListItem>5</asp:ListItem>
        </asp:DropDownList>


这篇关于asp .net代码将数据库表值带到文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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