B
Brook
Hi Everyone,
I've been interested in creating a custom control that wraps up a few common
UI elements and some styling. But, in order to make this earier to
understand, let's say my control is just a posh panel. It has curvy edges
rather than straight ones.
Now i have written a custom control which allows me to do the following in
aspx code :
<cc1:CurvyPanel runat="server">
<Content>
<asp:Label runat="server" Text="Hello World!"></asp:Label>
</Content>
</cc1:CurvyPanel>
The control is visible at runtime and design time.
However, when i try something a little more adventurous such as:
<cc1:CurvyPanel runat="server">
<Content>
<asp:Repeater ID="rptYears" runat="server">
<ItemTemplate>
<a href="<%#Eval("link") %>"><%# Eval("name")
%></a>
</ItemTemplate>
</asp:Repeater>
</Content>
</cc1:CurbyPanel>
Now, when i try to bind some data to my embedded repeater from my parent
page, it gives me the error
"InvalidOperationException was unhandled by user code
Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control."
So, I was hoping my "curvypanel" would behave in the same way as a normal
..NET panel in terms of allowing content inside it to be independantly bound
to a set of data... so either it doesn't allow this or ive done something
wrong.
Can anyone help me by clarifying whether what im trying to do is possible?
and if so, provide any input on how to go about it?
thanks,
Andrew
I've been interested in creating a custom control that wraps up a few common
UI elements and some styling. But, in order to make this earier to
understand, let's say my control is just a posh panel. It has curvy edges
rather than straight ones.
Now i have written a custom control which allows me to do the following in
aspx code :
<cc1:CurvyPanel runat="server">
<Content>
<asp:Label runat="server" Text="Hello World!"></asp:Label>
</Content>
</cc1:CurvyPanel>
The control is visible at runtime and design time.
However, when i try something a little more adventurous such as:
<cc1:CurvyPanel runat="server">
<Content>
<asp:Repeater ID="rptYears" runat="server">
<ItemTemplate>
<a href="<%#Eval("link") %>"><%# Eval("name")
%></a>
</ItemTemplate>
</asp:Repeater>
</Content>
</cc1:CurbyPanel>
Now, when i try to bind some data to my embedded repeater from my parent
page, it gives me the error
"InvalidOperationException was unhandled by user code
Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control."
So, I was hoping my "curvypanel" would behave in the same way as a normal
..NET panel in terms of allowing content inside it to be independantly bound
to a set of data... so either it doesn't allow this or ive done something
wrong.
Can anyone help me by clarifying whether what im trying to do is possible?
and if so, provide any input on how to go about it?
thanks,
Andrew