The ascx file:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl1.ascx.cs" Inherits="localhost.WebUserControl1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <%@ Register TagPrefix="cc1" Namespace="KrispWare" Assembly="SlickRater" %> Click here to rate <asp:Label Runat="server" ID="RatedLabel"></asp:Label>: <cc1:AutoSlickRater id="AutoSlickRater1" runat="server" Image="square.gif"> <cc1:Rating Name="Bogus"></cc1:Rating> <cc1:Rating Name="Uncool"></cc1:Rating> <cc1:Rating Name="There"></cc1:Rating> <cc1:Rating Name="Happening"></cc1:Rating> </cc1:AutoSlickRater>
The code-behind file:
C#public class WebUserControl1 : System.Web.UI.UserControl { protected System.Web.UI.WebControls.Label RatedLabel; protected KrispWare.AutoSlickRater AutoSlickRater1; public string RatedID { get { return AutoSlickRater1.RatedID; } set { AutoSlickRater1.RatedID = value; } } private void Page_Load(object sender, System.EventArgs e) { RatedLabel.Text = RatedID; } }
VB.NETPublic Class WebUserControl1 Inherits System.Web.UI.UserControl Protected RatedLabel As System.Web.UI.WebControls.Label Protected AutoSlickRater1 As KrispWare.AutoSlickRater Public Property RatedID() As String Get Return AutoSlickRater1.RatedID End Get Set (ByVal Value As String) AutoSlickRater1.RatedID = value End Set End Property Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) RatedLabel.Text = RatedID End Sub End Class