private void BindBarcodeDataToForm(BarcodeData data) { txtName.Text = data.Name; txtAddress.Text = data.Address; txtPost.Text = data.Post; txtAmount.Text = data.Amount.ToString(); txtReceiving.Text = data.Receiving.ToString(); txtNotes.Text = data.Notes.IndexOf('|') >= 0? data.Notes.Remove(0, data.Notes.IndexOf('|') + 1):data.Notes; txtDepartment.Text = data.Department; IList <AdditionItem> additionsItems = AddidtionsList.GetAll(data.Additions); int zone = (data.Additions >> 16); if (zone > 0) { ddlZone.Enabled = true; ddlZone.SelectedValue = (zone & 3).ToString(); } cbAdditions.DataSource = additionsItems; cbAdditions.DataTextField = "Label"; cbAdditions.DataValueField = "FlagValue"; cbAdditions.DataBind(); foreach (AdditionItem item in additionsItems) { ListItem li = cbAdditions.Items.FindByValue(item.FlagValue.ToString()); if (li != null) { li.Selected = item.Checked; } } }
private void bindBarcodeValue(int codeValue) { IList <AdditionItem> additionsItems = AddidtionsList.GetAll(codeValue); int zone = (codeValue >> 16); if (zone > 0) { ddlZone.Enabled = true; ddlZone.SelectedValue = (zone & 3).ToString(); } cbAdditions.DataSource = additionsItems; cbAdditions.DataTextField = "Label"; cbAdditions.DataValueField = "FlagValue"; cbAdditions.DataBind(); foreach (AdditionItem item in additionsItems) { ListItem li = cbAdditions.Items.FindByValue(item.FlagValue.ToString()); if (li != null) { li.Selected = item.Checked; } } }