Hithesh
Hithesh

Reputation: 449

how to bind the objectdatasource to html select <tag>?

Is there any way to bind a objectdatasource to an html select tag with runat=server attribute.

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

Upvotes: 0

Views: 553

Answers (1)

Rajeev Mehta
Rajeev Mehta

Reputation: 820

Try this

as like as an asp dropdown list box

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

C# Code

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

Upvotes: 1

Related Questions