not getting any data in lookup popup

Oct 19, 2011 at 3:10 PM
Edited Oct 19, 2011 at 3:15 PM

I'm not getting any data in the lookup popup though it is reaching the search method, I can also see data in rows which means lookuplist is fine.

<li class="ae-lookup-item" data-value="1"><span class="ae-lookup-mbtn fl"></span>aaaa</li><li class="ae-lookup-item" data-value="2"><span class="ae-lookup-mbtn fl"></span>bbbb</li>

Get method seems to be working fine.

what could be the problem?

Also in my case I can't get the count of data, so can I use something like more= Data!=null?true:false

 public ActionResult Search(string search, int page = 1)     

  {            var rows = this.RenderView(@"Awesome\LookupList", Data.Where(o => o.Name.ToLower().Contains(search.ToLower())));     

      return Json(new { rows, more = 2>1 });




Oct 19, 2011 at 4:53 PM

just debug and make sure that you rows has something in it,

about paging if more = true the "more" button will appear and when the user will click it the page will increment 

Oct 19, 2011 at 5:27 PM
Edited Oct 19, 2011 at 5:28 PM

rows has the proper values : <li class="ae-lookup-item" data-value="1">aaaa</li><li class="ae-lookup-item" data-value="2">bbbb</li>

but no data in lookup popup...

Oct 19, 2011 at 7:21 PM

look in firebug console for javasript errors, could be some id collisions, renaming the lookup or adding prefix could solve the problem

Oct 19, 2011 at 7:56 PM

could not find any javascript errors, will try afresh...

btw.. this was the html n javascript code that was generated:


  <div class="efield">
        <div class="elabel">
                Select Person
        <div class="einput">

<script type="text/javascript">
    function lgcPerson() {        
        $(this).addClass('ui-state-error').click(function(){$ae.lookupChoose('Person', '/PersonLookup/Get', 'ui-state-error');});
    $(function () {
        var o = 'Person';
        $ae.loadLookupDisplay(o, '/PersonLookup/Get');

        $ae.popup('lp'+o, 750, 400, 'please select', true, 'center', true, {'OK': function () {$ae.lookupChoose('Person', '/PersonLookup/Get', 'ui-state-error');},'Cancel': function () { $(this).dialog('close'); }}, false);

        var lckPerson = null;
        $ae.lookupPopupOpenClick(o, lckPerson, 
<div id='lpPerson'>
<input type="hidden" id="Person" name="Person" value="1" />
<input type="text" id="ldPerson" disabled="disabled"  />
<a class="ae-lookup-openbtn" id="lpoPerson" ></a>

        <div class="cbt"></div>




Oct 20, 2011 at 5:56 AM

still not working............

problem seems to be to get the paging to work..

        public ActionResult Search(string search)
           // return View(@"Awesome\LookupList", Data.Where(o => o.Name.ToLower().Contains(search.ToLower())));  //This is working fine
            var rows = this.RenderView(@"Awesome\LookupList", Data.Where(o => o.Name.ToLower().Contains(search.ToLower())));
            return Json(new { rows, more = true });

Can you please give me your emailid so that I can send you the source...



Oct 20, 2011 at 11:38 AM

you can put it somewhere and give link

Oct 20, 2011 at 2:03 PM
Edited Oct 20, 2011 at 2:04 PM

plz chk:



Oct 20, 2011 at 5:32 PM

the stuff that you sent me works:

Oct 20, 2011 at 6:12 PM

the following line in the search method in lookupcontroller works:

return View(@"Awesome\LookupList", Data.Where(o => o.Name.ToLower().Contains(search.ToLower()))); 
Please comment this line and uncomment the following lines and try:
        var rows = this.RenderView(@"Awesome\LookupList", Data.Where(o => o.Name.ToLower().Contains(search.ToLower())));    
        return Json(new { rows, more = true });

Oct 20, 2011 at 7:28 PM

it looks like the LookupAttribute does nothing, use this:

@Html.Lookup("FacebookFriend", prefix: "m", height: 300, width: 400,paging:true)

instead of Html.EditorFor

Oct 20, 2011 at 8:03 PM

tx but that is giving an error:

Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<MvcApplication8.Models.Person>' does not contain a definition for 'Lookup' and no extension method 'Lookup' accepting a first argument

of type 'System.Web.Mvc.HtmlHelper<MvcApplication8.Models.Person>' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 9:  </p>
Line 10: 
Line 11: @Html.Lookup("FacebookFriend", prefix: "m", height: 300, width: 400)



Oct 21, 2011 at 6:13 AM
Edited Oct 21, 2011 at 6:13 AM

well add the thing on the top that imports the namespace (or install resharper and it will put it for you)

Oct 21, 2011 at 6:17 AM


you didn't do this:

  ModelMetadataProviders.Current = new AwesomeModelMetadataProvider();
in App_Start
that's why LookupAttribute is not working
Oct 21, 2011 at 11:53 AM

y, thanks.....

Oct 22, 2011 at 12:19 PM
Edited Oct 22, 2011 at 12:37 PM

Now, the following code is working but paging still does not work though I see the show more button..

 var rows = this.RenderView(@"Awesome\LookupList", Data.Where(o => o.Name.ToLower().Contains(search.ToLower()))); 

return Json(new { rows, more = true });

I see the data first time...

When I select more, it is going to search method once again adding the data in rows variable but I don't see it getting added.

When I check the IE developer tools network pane, I see that it reached the browser as well but do not see it getting added to the <div id="modelname"+lsh>




P.S. I'm still using editorfor and not html.lookup as I could not understand which namespace needed to be imported ..

Oct 22, 2011 at 7:08 PM

@using Omu.Awesome.Mvc.Helpers

and I see the data getting added, but your adding the same thing all the time and more is always true

you need some paging, like this:


const int pageSize = 7;
var rows = this.RenderView(@"Awesome\LookupList", result.Skip((page.Value - 1) * pageSize).Take(pageSize));
return Json(new { rows, more = result.Count() > page * pageSize });
Oct 23, 2011 at 7:41 PM
Edited Oct 23, 2011 at 7:42 PM

In my case the paging is happening in another method which in turn calls a web service and so the result is different on every call and more is true or false based on whether result.count is zero or not.

If you see the data getting added, does it mean that you see after japan again austria, if so could you please mail me that soln.



Oct 24, 2011 at 6:21 AM

Oct 25, 2011 at 7:11 AM

I must be doing something really wrong, because can't see paging in the code u uploaded, then created a new app to start fresh..., but in this even search function is not getting called and no pop up which is a first...

Plz have a look 



Oct 25, 2011 at 7:35 AM

I deleted the Index action from the FacebookFriendLookupController and it worked

the LookupController already has an Index action but with many parameters ( in firebug console it was saying that it is an ambiguous  call)

Oct 25, 2011 at 8:43 AM

y, it did work,

could you please tell me how you debugged it,

I have mozilla firebug,

what did u exactly do to debug and where in console did u find the ambiguous call...



Oct 25, 2011 at 10:43 AM
Edited Oct 25, 2011 at 10:58 AM

ok, found something...

In firebug, net tab where all calls are shown there is a call http://localhost:30326/FacebookFriendLookup?prop=FacebookFriend&paging=false&multi=false

The response to it is copied below:

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The view '~\Views\Shared\Awesome\LookupPopup.ascx' or its master was not found or no view engine supports the searched locations. The following locations were searched:

at System.Web.Mvc.ViewResult.FindView(ControllerContext context)

Also found the same result in console ( it needed to be enabled).

.LookupPopup.ascx exists in Awesome folder which is in shared folder in views.

Any idea what I must be doing wrong..



Oct 25, 2011 at 11:04 AM

I guess you'll have to send me it again

Oct 25, 2011 at 11:19 AM

As this is the actual app, can't send it across...

the test app that I sent you works fine after removing index method..

Let me see if I can reproduce the problem in the test app, then will send it across..

meanwhile if you can think of something which might be the cause do let me know..



Oct 25, 2011 at 11:49 AM

ok, solved the problem by adding this to app_start

ViewEngines.Engines.Add(new WebFormViewEngine            {       

        PartialViewLocationFormats = new string[]