I want to use a PeoplePicker
or a PeopleEditor
on Mobile Devices(via browser, under SharePoint Mobile View) just like on a desktop browser.
Firstly, I tried to add the PeopleEditor control in code behind through C# code, in the .aspx file. The aspx file references sp.js
, sp.runtime.js
, sp.core.js
, MicrosoftAjax.js
that are also imported, but I still get a lot of JS error.
Secondly, I tried to customize my own PeoplePicker via Client Object Model, but I am still stuck on the same JS error.
Please tell me how to approach the goal any suggestion will be appreciated.
I reference the JS file by js code dynamically as below:
function loadScript(src, script, callback) {
script = document.createElement('script');
script.onerror = function () {
// handling error when loading script
alert('Error to handle:' + src);
}
script.onload = function () {
console.log(src + ' loaded ')
callback();
}
script.type = "text/javascript";
script.src = src;
document.getElementsByTagName('head')[0].appendChild(script);
}
And in the .cs file, I wrote my own control which inherit from System.Web.UI.MobileControls.MobileControl, and then in the CreateChildControls() function, I add the PeopleEditor dynamically:
protected override void CreateChildControls()
{
PeopleEditor peoplePick = new PeopleEditor();
peoplePick.AllowEmpty = false;
peoplePick.AllowTypeIn = true;
peoplePick.ErrorMessage = "No Names Found";
this.Controls.Add(peoplePick);
base.CreateChildControls();
}
Finally, I registered this control in .aspx file and added an instance:
<MyCustomeMobile:CustomeControl RunAt="Server" />
Then,I got those JS error:
- Uncaught TypeError: Cannot call method 'createRange' of undefined [from entityeditor:2]
- Uncaught RangeError: Maximum call stack size exceeded Uncaught ReferenceError:
- Uncaught ReferenceError: WebForm_DoCallback is not defined
Maybe there is another way to resolve this problem,what just i want is user can search people/group by typing userId in a textbox and then show user's name(just like on laptop browser).