I'm not sure about this, but you can add bas a custom attribute to ListItem. Try something like this and see if it works:
var table = new DataTable("TableName");
dropDownList.DataSource = table;
dropDownList.DataBind();
table.AsEnumerable().ToList().ForEach(r =>
dropDownList.Items.FindByValue(r.Field<int>("a").ToString()).Attributes["data-field"] = r.Field<int>("b").ToString());
If you prefer to use a regular foreach loop:
foreach (DataRow row in table.Rows)
{
var item = dropDownList.FindByValue(row.Field<int>("a").ToString());
if (item != null)
{
item.Attributes["data-value"] = row.Field<int>("b").ToString();
}
}
, ViewState, a, b , . , , , , .