asp.net - Adding additional attributes to CheckBoxList on DataBind -
i have checkbox list bound values database, follows
chktoplanguages.datasource = dssitelanguages; chktoplanguages.datatextfield = "language"; chktoplanguages.datavaluefield = "languageid"; chktoplanguages.databind();
however, need add value (altlanguage) custom attribute can access value in instances. how can add additional value attribute checkbox items on databind?
you're not going this, when faced issue before way see doing in pure .net following:
// create field on data source objects public languagefield { { return languageid + "_" + altlanguage; } } chktoplanguages.datasource = dssitelanguages; chktoplanguages.datatextfield = "language"; chktoplanguages.datavaluefield = "languagefield"; chktoplanguages.databind();
then, when values, split value "_" , can grab both values.