I want to wrap up a chunk of HTML render logic in a User Control. Then I want to pass a custom product object (title, thumbnail, id, etc.) to the UserControl that it can use when it renders. Ideally I want to use this in a repeater (or for loop) and pass the current custom product object into the UC.
Every example I've seen has been passing through strings on the UC tag but thats not really want I want to do as it means I'll have references everywhere that need updating should we add a new field that needs rendering.
Any ideas?
.Net 1 using VB.net (not my first choice for .net so go easy)
HTML example to get us going, this would be in the .ascx page:
<div>
  <h3><%= myProd.title %></h3>
  <img src="<%= myProd.thumbnail %>" />
  <p>
    <%= myProd.description %>
  </p>
</div>
UPDATE:
Ok so with some hacking around here is what I've come up with, its not working though, whats the missing piece of this puzzle?
Create a UserControl and add this to the code behind:
Public Class ProductRender
    Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    End Sub
    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub
#End Region
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub
    Private _product As productItem 
    Public Property myProd() As productItem 
        Get
            myProd = Me._product
        End Get
        Set(ByVal Value As productItem )
            Me._product = Value
        End Set
    End Property
End Class
In the UC ascx page I simply have the html above.
In the page that uses the UC I simply added the following for testing:
...usual ascx header stuff...
<%@ Register TagPrefix="ORC" TagName="productRender" Src="productRender.ascx" %>
<ORC:productRender id="Assetrender1" runat="server" asset="<%# getDummyProduct() %>" />
in the code behind I declare getDummyProduct as so:
Public Function getDummyProduct() As productItem
    getDummyProduct = New productItem( "DVD Player", "It plays DVDs!", "some_thumb.jpg", 30 )
End Function
Yet in my ascs page I get:"Object reference not set to an instance of an object"
Line 1:  <%@ Control Language="vb" AutoEventWireup="false" Codebehind="ProductRender.ascx.vb" Inherits="MyApp.ProductRender" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
Line 2:  <h3>
Line 3:  <%= myProd.title %>
Line 4:  </h3>