I have created a simple xml file that includes a small list of values to populate a dropdown list. I can map to the xml file read the data in the xml file and bind it to the dropdownlist.
Here is my question. I have a class library that I have created a dataset (.xsd) file with tableadapters that make calls to the database.
So, is there a way to add the dataset that pulls info from my xml file into the dataset in my class library?
I'm not sure how to do this? I want to keep all the data extraction seperate from the application. The way I have it now is the page code-behind:
protected void BindList()
string path = MapPath("~/products.xml");
DataSet dSet = new DataSet();
chklst.DataSource = dSet;
chklst.DataTextField = "name";
chklst.DataValueField = "productid";
Is it possible to move the dataset portion into the class library? If so, how?
Basically, what I'd like to have in the code-behind is the following:
GetEmployeeTableAdapter employee = new GetEmployeeTableAdapter();
ddlEmployee.DataSource = employee.GetEmployee();
ddlEmployee.DataTextField = "customer_id";
ddlEmployee.DataValueField = "recordID";
ddlEmployee.Items.Insert(0, new ListItem("Please select...", ""));
I just don't know how to create the dataset in the class library that reads from the xml. The table adapters only seem to connect to a database.
Is what I want to accomplish possible?
Thanks for any help.