Hi!
I'm trying do to a very simple task for testing purposes, change a label text when a user clicks a button. I create a new template and assign it to my masterpage, create a label and a button. After the successful compilation, I try it in the EPiServer edit mode after adding it as a new page type. This is where strange things start to happen: When I click the button in the edit-mode the label changes, but when I try it outside edit mode, the button_OnClick-event never occurs.
Any Ideas?
my aspx-template:
<%@ page language="C#" masterpagefile="~/templates/MasterPages/MyMaster.Master" autoeventwireup="true" codebehind="formtest.aspx.cs" inherits="EPiServerSample.templates.formtest" title="Untitled Page" %>
My CS-file:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EPiServer;
namespace EPiServerSample.templates
{
public partial class formtest : TemplatePage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Button clicked.";
}
}
}
/Jonas%@>
<%@ page language="C#" masterpagefile="~/templates/MasterPages/MyMaster.Master" autoeventwireup="true" codebehind="formtest.aspx.cs" inherits="EPiServerSample.templates.formtest" title="Untitled Page" %>
My CS-file:
%@>using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using EPiServer; namespace EPiServerSample.templates { public partial class formtest : TemplatePage { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "Button clicked."; } } }
/Jonas