如何在VB.NET中构造DropDownList [英] How to construct DropDownList in VB.NET

查看:107
本文介绍了如何在VB.NET中构造DropDownList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要一些帮助来构建vb.net服务器端的下拉列表。



我发现我可以从

Hi Everyone,

I am in need of some help with constructing a drop down list within vb.net server side.

I have found i can start with something like

Dim dl As New DropDownList

但我仍然坚持如何继续,我在网上寻求帮助,但这看起来很混乱。



我需要使用存储过程中的数据填充DropDownList



如果您需要更多代码或信息请询问



谢谢



我尝试使用以下代码填写DDL但是没有填充



but iam stuck as of how to continue, i have search online for help but it all looks confusing.

I need to populate the DropDownList with data from a stored procedure

if you need anymore code or info please ask

Thank you

I have tried filling in the DDL in with the following code but nothing is populated

If Request.QueryString("userid") <> "" Then

            Dim ddlResult As New DataSet
            ddlResult = GetUserName.ddlData(Request.QueryString("userid").ToString)

            sysDDL.DataSource = ddlResult
            sysDDL.DataValueField = "description"
            sysDDL.DataTextField = "description"
            sysDDL.DataBind()
            sysDDL.Items.Insert(0, New ListItem(String.Empty, String.Empty))
            sysDDL.SelectedIndex = 0

        End If





新密码...



包含DIV DDL



New Code...

DIV containing DDL

<div id="dUserSystems" runat="server" >
        <u>Systems user has access to</u><br />
            <div id="dUserData"></div>
        <br />

    <div id="ddlSysData" runat="server" >
         <u>Add new system to users account</u><br />
         <asp:DropDownList ID="sysDDL" runat="server"/>
    </div>
        <br />
        <input type="button" id="butAdd" value="Add" runat="server"/>&nbsp;
        <input type="button" onclick="butClose()" value="Close" />
</div>







我的函数从隐藏页面调用数据来为'dUserData'创建一个表,我想我可能需要在这里添加一些东西让DDL工作?






My function that calls data from a stealth page to create a table for 'dUserData' and i think i may need to add something in here for the DDL to work?

function viewSystems(myUserid) {


       var link = 'fetchData.aspx?userid=' + myUserid;

       $.get(link, function (data) {

           $("#dUserData").empty().append(data);
           $("#ContentPlaceHolder1_dUserSystems").css("left", "200px");
           $("#ContentPlaceHolder1_dUserSystems").css("display", "block");
       });


     }

   function butClose() {
       $("#ContentPlaceHolder1_dUserSystems").css("display", "none");
   }

推荐答案

.get(link, function (data){
.get(link, function (data) {


#dUserData)。empty()。append(data);
("#dUserData").empty().append(data);


# ContentPlaceHolder1_dUserSystems)。css( left 200px);
("#ContentPlaceHolder1_dUserSystems").css("left", "200px");


这篇关于如何在VB.NET中构造DropDownList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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