473,383 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Problems with properties on WebUserControl and Repeater

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
Nov 19 '05 #1
2 1571
I think there is a problem with you " around publisher type in your
ItemTemplate definition

PublisherType="<%# DataBinder.Eval(Container.DataItem, "PublisherType" %>">

Try using

PublisherType='<%# DataBinder.Eval(Container.DataItem, "PublisherType" %>'>

Notice I changed the outer quotes to a single quote.

bill

Dein English ist sehr gut!

"Michael Groeger" <go*********@web.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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

Nov 19 '05 #2
Hi Bill,
Try using

PublisherType='<%# DataBinder.Eval(Container.DataItem, "PublisherType" %>'>

Correct! Now it works, thank you.
Dein English ist sehr gut! Thank you ;) Does this mean that I translated the german text properly or do
you mean my english at all? ;)

Regards,
Michael

"Michael Groeger" <go*********@web.de> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gastin | last post by:
I am digesting a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to...
1
by: DichkoSoft | last post by:
Hi I create WebUserControl and very confused when use control For Example: ***************************** *wuc.ascx ***************************** <script id=clientEventHandlersJS...
2
by: Oren | last post by:
Hello everyone... I have a simple WebUserControl with Button and TextBox on it. Webform1.aspx contains this WebUserControl. How can I create my own C'tor for this WebUserControl - I mean when I...
2
by: Oren | last post by:
Hi everyone, I have WebUserControl on a Webform. How can I sent dynamically to the WebUserControl from a Function/Property on the Webform ? <uc:myuc id="myid1" CurrentPage=<%#GetText()%>...
0
by: riddion | last post by:
Hello. I am having problems with the repeater webform control. Inside the <ItemTemplate> section I have a Calendar control. This is for so the user can choose a different date on each of the...
0
by: Giovanni | last post by:
Dear Friends, I have a decision to make and hope to get some insight: I have built several WebUserControls one of which is a WebUserControl that queries an SQL server database, retrieves a...
2
by: Andy | last post by:
Hi, This is one of those things I thought should e easy... I'm programatically trying to set the navigateURL property in a hyperlink in the headertemplate of a repeater, but always get the...
0
by: Terry Olsen | last post by:
In an effort to create a QueryBuilder for a web page, I've created a WebUserControl. It can be seen here: http://boycot.no-ip.com/images/querybuilder.jpg I load one control initially in the...
0
by: Klaus Jensen | last post by:
Hi In a repeater-control, in the <SeparatorTemplatei have placed a webusercontrol, I have made. That works great- However, I want to know be able to only display this WebUserControl a certain...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.