protected void Page_Load(object sender, EventArgs e)
{
dr = new MySqlDataAdapter("select * from cus_mas_det", conn);
ds = new DataSet();
dr.Fill(ds, "cus_mas_det");
DataTable CodeDesc = new DataTable();
conn.Open();
dr = new MySqlDataAdapter("select tvl_code, concat_ws(',', tvl_code, citi_name) citiname from code_desc where travel_mode = 'BUS'", conn);
ds1 = new DataSet();
dr.Fill(ds1);
ddlfrom.DataSource = ds1;
ddlfrom.DataTextField = "citiname";
ddlfrom.DataValueField = "tvl_code";
ddlfrom.DataBind();
txtbookingdate.Text = System.DateTime.Now.ToString("yyyy/MM/dd");
txtbookingdate.ReadOnly = true;
txtbookingref.Text = autoid();
txtbookingref.ReadOnly = true;
}
我有一个 asp 页面,其中有文本框和组合框,我正在从数据库中填充组合框,如上面的代码中给出的那样,我能够填充它。
现在我的问题是我想通过在组合框中输入任何单词来搜索元素。
例如,如果我输入单词“Ab”,它应该显示所有以“Ab”开头的元素。
怎么做?
<asp:ComboBox ID="ddlfrom" class="chzn-select" runat="server"
DataTextField="name" DataValueField="name" MaxLength="0"
style="display: inline;"
onselectedindexchanged="ddlfrom_SelectedIndexChanged1">
</asp:ComboBox>