Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3287116
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:27:25+00:00 2026-05-17T20:27:25+00:00

As a follow on from one of my previous posts ( ASP.NET MVC2 Master

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:27:26+00:00Added an answer on May 17, 2026 at 8:27 pm

    UserControls with runat="server" are a no-no in ASP.NET MVC. They are dependent on the classic WebForms life-cycle which no longer exists in MVC, not even talking about ViewState and PostBack models.

    Looking at the name of this control it looks like a pager. There’s a nice collection of HTML helpers for rendering paginated grids in ASP.NET MVC you might take a look at.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note that this is a follow-up question from my previous one: How to memorize
OK, this question is actually a follow-up question from my previous one: What would
This is a follow up question from my previous one found here I need
Follow on from a previous question One first screen activity I am clicking a
this is a follow up question from my previous one. you can find it
This question is a follow on from this one ... I am binding to
Follow up question from Multi-core usage, threads, thread-pools . Are threads moved from one
This is a follow-on question from the one I asked here . Can constraints
This is a follow up from my previous question I have this code basically
This is a follow-on from a previous SO question Anchoring CSS Repeating Background Image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.