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

  • Home
  • SEARCH
  • 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 8618381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:05:36+00:00 2026-06-12T06:05:36+00:00

I am trying to make an ascx control that can be templated by our

  • 0

I am trying to make an ascx control that can be templated by our front-end developers by just making a new .ascx and pointing to that specific .ascx in that instance. However, I am having issues with accessing properties in shared code-behind scenarios.

I have the following code behind that’s shared

public partial class TemplateCodeBehind : TemplateControlBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    // Ascx Available properties
    public string GetOption1Value { get { return Option1; } }
    public string GetOption2Value { get { return Option2; } }
    public string GetOption3Value { get { return Option3; } }
    public string GetOption4Value { get { return Option4; } }
}

Note that those options that are returned are public properties of the TemplateControlBase class. In my Templates subfolder I have the following ascx

<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="../TemplateCodeBehind.ascx.cs" Inherits="MyNamespace.JqueryTemplates.TemplateCodeBehind" %>
<%@ Import Namespace="MyNamespace.JqueryTemplates" %>

<div>
     Option1: <%= GetOption1 %>

</div>

This compiles fine, but when I try to load my test ascx I get the following error

An error has occurred. DotNetNuke.Services.Exceptions.PageLoadException: c:\Projects\DNN-Dev\Website\DesktopModules\Module.JqueryTemplates\Templates\Test.ascx(5): error CS0103: The name ‘GetOption1’ does not exist in the current context

I have tried changing <%= to <%# and calling Page.Databind() but nothing seems to work.

Any ideas on how I can accomplish this?

  • 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-06-12T06:05:37+00:00Added an answer on June 12, 2026 at 6:05 am

    In the ascx file change GetOption1 to GetOption1Value

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

Sidebar

Related Questions

I'm trying to make a generic Search UserControl that can be given some values,
Trying to make a regex that can handle input like either: Beverly Hills, CA
I'm trying make an entity with doctrine that has three associations with other entities
I am fairly new to iOS development and trying make a simple app which
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
I have an ImageMap control in an ascx file of mine. I'm trying to
trying to make 5 curl childs for curl handler and defining them, but can't
I'm trying make a simple control, with a some path in it. And binding
I'm trying make one treeView with infinite subgroups. I can add my groups but

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.