如何将objectdatasource绑定到html select <tag>?</tag>

时间:2014-11-03 07:01:40

标签: html asp.net

有没有办法将objectdatasource绑定到带有runat = server属性的html select标记。

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

1 个答案:

答案 0 :(得分: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();