Using List Picker Control in Custom WebPart Properties

if you are developig custom webpart and one of the requirements is getting list title as webpart property. so, you can do that by just adding custom Property as text and the user write list title and you in code behind will handle and validate list title and check if this list already exist or not. Also if you want to query , add or update list in subsite , you will need to add relative path to the list. to override all of these , you can add Out of the Box List Picker, just you will develop custom toolpane for the list and add TextBox and Button to handle user Click.

Let us do an example ,

1-firstly, we need to create custom toolpane Class as the following, here, we need two controls TextBox to get Full path of selected List and Button to handle User Click.

3- define Init Function, in this function will add define Script Link Control , and in Name Property add “AssetPickers.JS” Load OOTB JavaScript File which is responsible for Opening nice picker dialog where you can choose the List