DefeatObama
New Member
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\[code\]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; } }}\[/code\]Note that those options that are returned are public properties of the \[code\]TemplateControlBase\[/code\] class. In my Templates subfolder I have the following ascx\[code\]<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="../TemplateCodeBehind.ascx.cs" Inherits="MyNamespace.JqueryTemplates.TemplateCodeBehind" %><%@ Import Namespace="MyNamespace.JqueryTemplates" %><div> Option1: <%= GetOption1 %></div>\[/code\]This compiles fine, but when I try to load my test ascx I get the following error\[quote\] 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 \[/quote\]I have tried changing \[code\]<%=\[/code\] to \[code\]<%#\[/code\] and calling \[code\]Page.Databind()\[/code\] but nothing seems to work.Any ideas on how I can accomplish this?