private void LoadMedicines()
        {
            var medModel = new MedicineModel();
            var medDal   = new MedicineDAL();

            oDs = new DataSet();

            //medModel.ItemName = SearchMed.Value;

            ////oDs = medDal.SeachData(medModel);
            oDs = medDal.SelectAll();

            var medsTable = new DataTable();

            medsTable.Columns.Add("id");
            medsTable.Columns.Add("dname");
            var medsRow = medsTable.NewRow();

            medsRow[0] = 0;
            medsRow[1] = "--Select Medicine--";
            medsTable.Rows.Add(medsRow);

            if (oDs != null)
            {
                if (oDs.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
                    {
                        var medsFinal = medsTable.NewRow();
                        medsFinal[0] = oDs.Tables[0].Rows[i]["id"].ToString();
                        medsFinal[1] = oDs.Tables[0].Rows[i]["dname"].ToString();
                        medsTable.Rows.Add(medsFinal);
                    }
                }
            }



            medsList.DataSource     = medsTable;
            medsList.DataValueField = "id";
            medsList.DataTextField  = "dname";

            medsList.DataBind();
        }
Esempio n. 2
0
        private void LoadMedicines()
        {
            var medModel = new MedicineModel();
            var medDal   = new MedicineDAL();

            oDs = new DataSet();

            medModel.ItemName = SearchMed.Value;

            //oDs = medDal.SeachData(medModel);
            oDs = medDal.SelectAll();
            cbMedList.DataSource     = oDs.Tables[0];
            cbMedList.DataValueField = "code";
            cbMedList.DataTextField  = "dname";

            cbMedList.DataBind();

            myDropDownlistID.DataSource     = oDs.Tables[0];
            myDropDownlistID.DataValueField = "code";
            myDropDownlistID.DataTextField  = "dname";
            myDropDownlistID.DataBind();
        }