3

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:

  1. Uncaught TypeError: Cannot call method 'createRange' of undefined [from entityeditor:2]
  2. Uncaught RangeError: Maximum call stack size exceeded Uncaught ReferenceError:
  3. 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).

4
  • 1
    Hi and welcome to SP.SE Jason. You have a good question, but to be able to answer it we need a little more detail. Could you supply the error message from JavaScript Console, and also the failing source code. With that information added to the question, I'm confident that you will get guidance. Nice to see you on our site!
    – Benny Skogberg
    Commented Nov 2, 2013 at 8:14
  • 1
    Hi Benny,I'm a newer here.Thanking for your advice in advanced.I have added some detail information.if not enough,i will paste all of the code.Thanks agian!
    – Jason Chan
    Commented Nov 2, 2013 at 14:43
  • @BennySkogberg Could you please give me some adivce?
    – Jason Chan
    Commented Nov 3, 2013 at 6:28
  • 1
    I'm Sorry, but I don't know how to solve your problem. I still hope for somebody else to answer the question you have. If not today, probably on Monday.
    – Benny Skogberg
    Commented Nov 3, 2013 at 7:58

1 Answer 1

0

You have to create some custom control or Custom code for that.

I will suggest you can use CSOM for get users. Below is the example might be use full to you

http://msdn.microsoft.com/en-us/library/jj713593.aspx

Your Answer

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

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