M
Michael Groeger
Hi,
I have created a little WebUserControl "SelectTemplate.ascx" which defines a
property
public class SelectTemplate : System.Web.UI.UserControl
{
public int PublisherType
{
get;
set;
}
}
On my form, I want to have a repeater which creates for each value in a
collection of "Publisher" items (=DataSource) a SelectTemplate control and
set the PublisherType property to the value of the corresponding property in
a Publisher.
public class Publisher
{
public int PublisherType
{
get;
set;
}
}
I added a repeater to my form and changed to code behind to edit Page_Load
as followed:
public void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
Repeater1.DataSource = _Publishers; // _Publishers actually is
stored in the session state
Repeater1.DataBind();
}
}
Then I switched to html view and edited the InnerTemplate of the repeater:
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<uc1:SelectTemplate id="SelectTemplate1" runat="server"
PublisherType="<%# DataBinder.Eval(Container.DataItem, "PublisherType"
%>"></uc1:SelectTemplate>
</ItemTemplate>
</asp:Repeater>
Unfortunateley, when executing the code, I get the following - quite
uninformational error:
Parser-Error: Servertag not formatted property
Sorry, I am having german version of .NET installed, so I had to translate
to english. The german message sounds as follows:
Parser-Fehlermeldung: Servertag wurde falsch formatiert.
Can somebody help me out?
Regards,
Michael
I have created a little WebUserControl "SelectTemplate.ascx" which defines a
property
public class SelectTemplate : System.Web.UI.UserControl
{
public int PublisherType
{
get;
set;
}
}
On my form, I want to have a repeater which creates for each value in a
collection of "Publisher" items (=DataSource) a SelectTemplate control and
set the PublisherType property to the value of the corresponding property in
a Publisher.
public class Publisher
{
public int PublisherType
{
get;
set;
}
}
I added a repeater to my form and changed to code behind to edit Page_Load
as followed:
public void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
Repeater1.DataSource = _Publishers; // _Publishers actually is
stored in the session state
Repeater1.DataBind();
}
}
Then I switched to html view and edited the InnerTemplate of the repeater:
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<uc1:SelectTemplate id="SelectTemplate1" runat="server"
PublisherType="<%# DataBinder.Eval(Container.DataItem, "PublisherType"
%>"></uc1:SelectTemplate>
</ItemTemplate>
</asp:Repeater>
Unfortunateley, when executing the code, I get the following - quite
uninformational error:
Parser-Error: Servertag not formatted property
Sorry, I am having german version of .NET installed, so I had to translate
to english. The german message sounds as follows:
Parser-Fehlermeldung: Servertag wurde falsch formatiert.
Can somebody help me out?
Regards,
Michael