0

I am tried to create table structure with header,body,footer in listview which works fine.

But in footer which is in layouttemplate, i tried to add below code which gives error.

<LayoutTemplate>
                    <table class="sampletable" cellpadding="0" cellspacing="0">
                        <thead class="tableheader">
                            <tr>
                                <th>
                                    <a>Samples </a>
                                </th>
                            </tr>
                        </thead>
                        <tbody class="tablebody">
                            <tr id="itemplaceHolder" runat="server">
                            </tr>
                        </tbody>
                        <tfoot class="tablefooter">
                            <tr>
                                <td>
                                    <a href='<%:Page.GetRouteUrl("samplelist",null) %>'>more sample</a>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                   </LayoutTemplate>

Is it not allowed to place in layouttemplate?

The error is

"The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."

CoreLean
  • 2,139
  • 5
  • 24
  • 43

1 Answers1

0

Use the 'RouteUrlExpressionBuilder'.

<a href='<%$ RouteUrl:routename=namedroute %>' runat="server">Link</a>

Properly documented at MSDN.

p.campbell
  • 98,673
  • 67
  • 256
  • 322
aanund
  • 1,483
  • 11
  • 18