I added some custom attributes to checkboxlist, but I wonder why I failed to retrieve the values of custom attributes. It will be something like this post jQuery - find control using custom attribute. But what I want is retrieve through auto postback and code behind.
int temp = 0;
foreach (DataRow rows1 in ds_ss_equipments_data.Tables[0].Rows)
{
cblEquip.Items.Add(new ListItem(rows1["name"].ToString() + " " + rows1["quota"].ToString() + " X " + rows1["price"].ToString(), rows1["id"].ToString()));
cblEquip.Items[temp].Attributes["price"] = rows1["price"].ToString();
cblEquip.Items[temp].Attributes["id"] = rows1["id"].ToString();
cblEquip.Items[temp].Attributes["quota"] = rows1["quota"].ToString();
temp += 1;
}
foreach (ListItem li in cblEquip.Items)
{
if (li.Selected)
{
equip += (Convert.ToDecimal(li.Attributes["price"]) * Convert.ToInt32(li.Attributes["quota"]));
}
}