0

I created a child template from visual studio to manage my kentico template. The template worked fine except that all the controls in it is not accessible from code behind because it is not recognized. I have checked for on line solution but none solved the issue. I even got this link Codebehind file doesn't recognize aspx-controls without any luck since I can't even access the myfile.aspx.designer.cs.

What do I trie again?

Note: My controls are not inside any panel or other control. Just inside a normal div.

Community
  • 1
  • 1
Peter
  • 793
  • 3
  • 8
  • 31
  • If you right click on the .aspx file in Visual Studio do you get a 'convert to web application' option? If so try that. Also check that the namespace in your page directive matches your class name in code behind. – geedubb Sep 16 '13 at 15:14
  • no I don't get that option. It's a website not an application although. – Peter Sep 16 '13 at 15:24
  • When I right clicked on the page and clicked on "View Component Designer" option it gave me an error page " The designer must create an instance of type CMS.UIControls.TemplatePage but it cannot because the type is declared as abstract." – Peter Sep 16 '13 at 15:55
  • What do you mean by saying you can't access the designer.cs file? Is it in file system? – rocky Sep 17 '13 at 16:24

2 Answers2

1

Try adding runat="server" to your id tag.

Here is an example.

<tr class="headerrow" id="tbrHeader" runat="server">  
julienc
  • 19,087
  • 17
  • 82
  • 82
0

I am unfamiliar with Kentico, but this is what I have come up with as possible solutions without having seen your code:

  • Make sure all your controls have a 'runat' attribute: runat="server". I am not trying to insult your intelligence, but it is an easy thing to forget(As I have done before), without this the control won't be recognised from code-behind

  • If it is a template file, have you made sure the codebehind that refers to it, is the code-behind of the template file, as the codebehind of other pages will not be able to find the control in the template without you telling them where it is.

  • With your new comment on the question: If your class is abstract, have you tried wrapping it in a non-abstract class? (source: stackoverflow.com/questions/481305)

Amber
  • 812
  • 8
  • 21
  • I have checked all that. – Peter Sep 16 '13 at 16:15
  • With your new comment on the question: If your class is abstract, have you tried wrapping it in a non-abstract class? (source: http://stackoverflow.com/questions/481305) – Amber Sep 17 '13 at 08:23