【问题标题】:how to bind the objectdatasource to html select <tag>?如何将 objectdatasource 绑定到 html select <tag>?
【发布时间】:2014-11-03 15:08:22
【问题描述】:

有什么方法可以将 objectdatasource 绑定到具有 runat=server 属性的 html select 标签。

<select size="1" id='standard' onchange="toggleOption(this)" name='standard' class='custom-select' >

【问题讨论】:

    标签: html asp.net


    【解决方案1】:

    试试这个

    就像一个asp下拉列表框

    <select size="1" id="standard" runat="server" onchange="toggleOption(this)" name='standard' class='custom-select' >
    

    C#代码

     standard.DataTextField = "title";
            standard.DataValueField = "val";
            standard.DataSource = SrCity;
            standard.DataBind();
    

    【讨论】:

    • 我已经尝试了上面的代码,如何在 c# 代码中使用 html Id(standard)。它显示错误无法解析符号 'standard'
    猜你喜欢
    • 1970-01-01
    • 2013-05-09
    • 2016-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-08
    • 1970-01-01
    相关资源
    最近更新 更多