# Problem to get a page from Template when we have a panel in aspx

**URL:** <https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [October 17, 2019, 8:38am UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158 "2019-10-17T08:38:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jessica](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/jessica/32/298_2.png) [@Jessica](https://forum.litium.com/u/Jessica)\
**Post date:** [October 17, 2019, 8:38am UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/1 "2019-10-17T08:38:55Z")

</div>

We try to get a page to redirect to from a panel that are created in aspx. And we can’t use the same function as we use for other pages. We got null when we tries to do the last step, .MapTo().

we use this one:

```
            var pageTemplate = _fieldTemplateService.Get<PageFieldTemplate>(pageTemplateName);
            
            using (var query = IoC.Resolve<DataService>().CreateQuery<Page>())
            {
                query.Filter(f => f
                           .TemplateSystemId("eq", pageTemplate.SystemId))
                           .ToList()
                           .ToLookup(x => x.WebsiteSystemId);

                return query.Count() > 0 ? query.FirstOrDefault().MapTo<PageModel>() : null;
            }
```

---

<div class="post-metadata">

**Author:** ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)\
**Post date:** [October 17, 2019, 10:52am UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/2 "2019-10-17T10:52:35Z")

</div>

What version are you on?

---

<div class="post-metadata">

**Author:** ![Jessica](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/jessica/32/298_2.png) [@Jessica](https://forum.litium.com/u/Jessica)\
**Post date:** [October 17, 2019, 11:04am UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/3 "2019-10-17T11:04:58Z")

</div>

7.2.3 sorry for forget to add it.

---

<div class="post-metadata">

**Author:** ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)\
**Post date:** [October 17, 2019, 11:26am UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/4 "2019-10-17T11:26:34Z")

</div>

We tried this and it works for us, check pageTemplateName to be sure it exists. It is the Id of the page template.

---

<div class="post-metadata">

**Author:** ![Jessica](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/jessica/32/298_2.png) [@Jessica](https://forum.litium.com/u/Jessica)\
**Post date:** [October 17, 2019, 12:14pm UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/5 "2019-10-17T12:14:14Z")

</div>

It working from the public site, but not from a panel.

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [October 17, 2019, 12:35pm UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/6 "2019-10-17T12:35:52Z")

</div>

When mapping to PageModel some additional info needs to be set, I’m guessing it isn’t when it’s done from a panel.

Have a look at this thread: [Problem with mapping in scheduled task](https://forum.litium.com/t/problem-with-mapping-in-scheduled-task/837/5)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [November 14, 2019, 12:36pm UTC](https://forum.litium.com/t/problem-to-get-a-page-from-template-when-we-have-a-panel-in-aspx/1158/7 "2019-11-14T12:36:02Z")

</div>

Closed on November 14, 2019, 12:36pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
