Hi,
As a follow on from one of my previous posts (ASP.NET MVC2 Master Page - Server side script not rendering, first bracket being escaped) I now having a similar problem.
This time it is with trying to dynamically set the properties of a UserControl.
*For anyone familiar with N2CMS, it is the AdvancedPager control.
Here is what I am doing:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.master" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage<Products>" %>
<%@ Register TagPrefix="AddOn" TagName="Pager" Src="~/Views/SharedParts/PagerControl.ascx" %>
<asp:Content ContentPlaceHolderID="Head" runat="server">
// content for head section
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<AddOn:Pager runat="server" ID="AdvPager" PerPage="<%= Model.ItemsPerPage %>" Total="<% Model.Count %>" />
</asp:Content>
The issue appears to be the value being set in the PerPage or Total property. I can't debug this because I don't have the source, however, I believe it is the same problem I was getting in my previous post because if I replace the dynamic ASP code with hard-coded values it works fine.
Any idea's of a work-around? I have tried putting the entire thing into a String.Format
but that simply outputs <AddOn:Pager runat="server"...
to the page, it doesn't actually render the control correctly.