private void BindCreditAgencies()
 {
     CreditAgencyBL bl = new CreditAgencyBL();
     grdAgency.DataSource = bl.GetAgencies().OrderBy(c => c.CreditAgency1).ToList();
     grdAgency.DataBind();
 }
        public void BindCreditRatingTree()
        {
            CreditAgencyBL agencyBL = new CreditAgencyBL();
            List<CreditAgency> agency = agencyBL.GetAgencies();

            List<TreeViewData> treeData = new List<TreeViewData>();
            //treeData.Add(new TreeViewData(1,null, "Credit Rating","Credit Rating"));
            int i = 1;
            int j = 1;
            foreach (var item in agency)
            {
                treeData.Add(new TreeViewData(i.ToString(), null, item.CreditAgency1, item.CreditAgency1));

                i++;

                CreditRatingsBL ratingbl = new CreditRatingsBL();
                List<CreditRating> rating = ratingbl.GetRatingsByAgencyID(item.ID);
                int innerVal = 0;
                int totalCount = rating.Count;
                foreach (var a in rating)
                {

                    treeData.Add(new TreeViewData(i.ToString(), j.ToString(), a.Rating, a.ID.ToString()));
                    innerVal++;
                    if (innerVal == totalCount)
                    {
                        j = i;
                    }
                    i++;

                }
                j++;
            }

            tvCreditRating.DataTextField = "Text";
            tvCreditRating.DataFieldID = "ID";
            tvCreditRating.DataFieldParentID = "ParentID";

            tvCreditRating.DataValueField = "Val";
            tvCreditRating.DataSource = treeData;

            // tvCreditRating.DataBindings.Add(binding1);
            //tvCreditRating.CheckBoxes = true;
            tvCreditRating.DataBind();
        }
 private void BindAgencyDropDown()
 {
     CreditAgencyBL bl = new CreditAgencyBL();
     ddlAgency.DataSource = bl.GetAgencies().OrderBy(c => c.CreditAgency1).ToList();
     ddlAgency.DataTextField = "CreditAgency1";
     ddlAgency.DataValueField = "ID";
     ddlAgency.DataBind();
 }