private void BindDropDown() { Classes.CBank cv = new Classes.CBank(); Dictionary <int, string> VendorData = new Dictionary <int, string>(); List <Models.MBank> get = new List <Models.MBank>(); get = cv.GetAll(); VendorData.Add(-1, "Please Select"); for (int i = 0; i < get.Count; i++) { VendorData.Add(Convert.ToInt32(get[i].id), get[i].Name + " Branch: " + get[i].BranchCode); } ddlBankId.DataTextField = "Value"; ddlBankId.DataValueField = "Key"; ddlBankId.DataSource = VendorData; ddlBankId.DataBind(); }
private void BindData() { Classes.CBank cb = new Classes.CBank(); grdBank.DataSource = cb.GetAll(); grdBank.DataBind(); }