Simple User Control Problem
I created a very simple user control, uploaded, and created a toolbox item into a Sitefinity 4.2 installation. The control has a button that increments a counter and displays a label that says Hello World and the counter number
The codebehind is as folows and I did not have to alter it
Public Class ucHelloWorld Inherits System.Web.UI.UserControl Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click HiddenField1.Value = HiddenField1.Value + 1 Label1.Text = "Hello World " & HiddenField1.Value End SubEnd Class<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ucHelloWorld.ascx.vb" Inherits="OsUserControls.ucHelloWorld" %> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:HiddenField ID="HiddenField1" runat="server" Value="0" /><%@ Control Language="vb" AutoEventWireup="false" CodeFile="ucHelloWorld.ascx.vb" Inherits="ucHelloWorld" %> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:HiddenField ID="HiddenField1" runat="server" Value="0" />SF3 was a website project where you could change code on a whim, but 4.x is a web app project which needs compilation for the code to work\update
Does this article help at all perhaps?
Thanks Steve.
With that said, is there a problem with appoaching a user control in this way and just changing CodeBehind to CodeFile or am I asking for trouble?