0

I have a SharePoint list with field Country and employee. it has 10 records. values of the country are US (for 5 records) and the UK (for 5 records). I am binding employee value into dropdown and used below code.

BindDropDown("Employee", "Employee", ddlEmployee, objDataTable);

it is showing me all 10 records, but I want to bind only for the US ( means only 5 employees name should be bind and displayed in a drop-down.) what change I need to do in my code. please suggest.

Thanks

  • Here apply filter condition in objDataTable to get records for the country US only – SynozeN Technologies May 18 '17 at 5:01
  • can you share line of code which i need to add or code which i need to modify. Thanks – Brishal May 18 '17 at 5:05
0
 DataView dv = new DataView(objDataTable);
 dv.RowFilter = "country = 'US'"; //replace Country=column name and US = your value

Then pass your dv to your BindDropDown.

  • i have used below DataView dv = new DataView(objDataTable); dv.RowFilter = "country = 'US'"; BindDropDown("Employee", "Employee", ddlEmployee, dv); but getting error in binddropdown – Brishal May 18 '17 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.