PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

新做模板调用新自定义字段出错,请高手指点 [复制链接]

1#
@{
    int columnId = Html.CurrentColumnId();
    dynamic infoData = Html.InfoData();
    dynamic prevData = Html.InfoDataPrevious("columnid=@columnId", new { columnId = columnId });
    dynamic nextData = Html.InfoDataNext("columnid=@columnId", new { columnId = columnId });
}

    <div class="clear padding-top-10 padding-bottom-10">
        <div class="web_navs1 zlm_left">
            @Html.Partial("subNavPartialleft")
        </div>
        <div class="web_wz_wc zlm_right">
            @Html.Partial("BreadcrumbPartial")
            <table class="letterinfo" width="100%" cellspacing="0" cellpadding="0" border="0">
                <tbody>
                    <tr class="head">
                        <td colspan="2" align="center"><b>班组工作</b></td>
                    </tr>
                    <tr>
                        <td width="100" align="right">上班时间:</td>
                        <td>@infoData.Sbsj</td>
                    </tr>
                    <tr>
                        <td align="right">当班班长:</td>
                        <td>@infoData.Dbbz</td>
                    </tr>
                    <tr>
                        <td align="right">工作内容:</td>
                        <td>
                            @infoData.Gznr
                        </td>
                    </tr>
                    
                    <tr>
                        <td colspan="2" align="center"><a href="javascript:history.back()">返回上一页</a></td>
                    </tr>

                </tbody>
            </table>

        </div>
    </div>              以上工作时间、当班班长、工作内容字段都是新添加的自定义字段,发布内容后,前台显示如下:Server Error in '/' Application.
Cannot perform runtime binding on a null reference
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: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference

Source Error:


Line 19:                     <tr>
Line 20:                         <td width="100" align="right">上班时间:</td>
Line 21:                         <td>@infoData.Sbsj</td>
Line 22:                     </tr>
Line 23:                     <tr>

Source File: f:\2019.9.23最新模板\gov5_blue\Templates\gov5_blue\views\班组工作\Detail.cshtml    Line: 21

Stack Trace:


  请高手指点,谢谢
分享 转发
TOP
2#

出这个错误一般都是因为你栏目设置中栏目模板调用了内容页模板

有些语法只能用在内容页模板中,你截图看一下你栏目设置,模板是怎么调用的?
TOP
3#

谢谢老大,确实是调用了内容页模板,现在调用正常
TOP
发新话题 回复该主题