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

2
  • Here apply filter condition in objDataTable to get records for the country US only May 18, 2017 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, 2017 at 5:05

1 Answer 1

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.

1
  • 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, 2017 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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