custom lookup popup

Dec 30, 2010 at 5:49 PM

If I wanted to view an image along with a text in lookup popupbox,which file do I need to change and how?

Thanks and best regards


Dec 30, 2010 at 6:40 PM

you can in the LookupList action to  return whatever view you want but look first at the content of the LookupList.ascx and make it kinda the same

that's for the current version,


for the new version I changed a bit the concept of the Lookup, there's no more ViewData["structure"] thing,

instead for each Lookup you have to create an item.ascx strongly typed to your Model, where you could write something like this:

<li data-value=<%=Model.Id%> >

name : <%=Model.Name %>

picture: <img src="<%=Model.ImagePath %>" />



only the <li data-value="key" thing is required, in the rest you write any way you want

Jan 4, 2011 at 9:19 AM
Edited Jan 4, 2011 at 9:20 AM

Thanks for your reply, 

Can I use your pagination inside lookuplist?

Best regards


Jan 4, 2011 at 12:22 PM

the very first version (7 months ago) had pagination, but after I thought that it's useless since we do search in there, and you can also return just top(5 or 10) search result. Also I think that a better approach now is the "show more results" button.

My Html.Pagination wont help here. It's source code can help.

Jan 4, 2011 at 8:07 PM

I understand your point. But what happens in some cases is - number of results are huge and it takes a long time and if i now use image its going to get worse. If I just return  a specific number of results the user has no way of knowing that there are more results and he should do a search.

Please guide how to implement show more results button and if it is possible to at least show the user total number of results



Jan 4, 2011 at 8:59 PM

ok, something quick for now is:

if you use your own custom LookupList.ascx (could be exactly the same as mine) in the action that returns it put ViewData["more"] = how much more there is

and in the LookupList.ascx <%=ViewData["more"] %>

as for the show more results button, I think I will do this in the near future, I'll show you how to do this and after I will put it in the live demo

Jan 13, 2011 at 1:59 PM

try the new version, lookup now has pagination and multiselect, also there no more ViewData.Structure instead you do an item.ascx