I want to programatically fill values for the combox by reading values from external datasource (Sharepoint list).
I am using C#.
I have connected my combobox control to this SPList to retieve rows. My SPList has name of employees, salaries and department.
Now depending on the salary entered by the User, I want to show the list of employees(dropdown) having salaries greater than entered value in the dropdown box.
My thought:-
I am thinking of using listbox changed event to fill the dropdown box. I think that as I am already connected to list, on load the combobox has list of all employees. I probably have to delete them when the textbox values changes and then add/fill values to that combobox.
XPathNavigator root = MainDataSource.CreateNavigator();
string salary = root.SelectSingleNode("//my:salary", NamespaceManager).Value;
// Retrieve a reference to the SharePoint list
XPathNavigator secDS = DataSources["ESalaries"].CreateNavigator();
// Search for the email address in the SharePoint list
XPathNavigator contact = secDS.SelectSingleNode("/dfs:myFields/dfs:dataFields/dfs:ESalaries[@salaries >= " + salary + "]",
NamespaceManager);
The above statement is not working, coz i assume that the salaries>=salary will return a list of String values instead of a single value. And next, how do I iterate through the returned values and add them to the combobox.
Please please help me with the code......