cannot have children of type 'DataBoundLiteralControl'

J

Jim Heavey

I am using the DataList
The ItemTemplate has a button and a label. The label field is bound to
a datatable and a field called "Narrative". The button is labeled
"Edit". When the edit button is clicked, the edit Template displays a
number of buttons and it attempts to display that "Narrative" in a text
box, allowing the user to edit the text of the narrative.

When I run and press the "Edit", the system stops in the Edit Template
and highlights the "Narrative" text box control and gives me the
following error message "System.Web.HttpException: 'TextBox' cannot have
children of type 'DataBoundLiteralCont".

Why does it not like me using the same field again with a textbox
control?


Here is my itemTemplate

<ItemTemplate>
<asp:Button Text="Edit" CommandName="Select" Runat="server">
</asp:Button>
&nbsp;<asp:Label ID="lblDesc" Runat="server">
<%# DataBinder.Eval(Container.DataItem, "Narrative" ) %>
</asp:Label>

</ItemTemplate>

Here is my EditTemplate

<EditItemTemplate>
<asp:Button CommandName="Update" Text="Update" Runat="server">
</asp:Button>
<asp:Button CommandName="Delete" Text="Delete" Runat="server">
</asp:Button>
<asp:Button CommandName="Cancel" Text="Cancel" Runat="server">
</asp:Button><br>
Sequence
<asp:TextBox><%# DataBinder.Eval(Container.DataItem,"Seq")%>
</asp:TextBox>
Bullet Type
<asp:DropDownList Runat="server">
<asp:ListItem>Header</asp:ListItem>
<asp:ListItem>Bullet</asp:ListItem>
</asp:DropDownList>
&nbsp;
***** This is where it bombs off **********************
<asp:TextBox Runat="server" ID="txtNarrative">
<%# DataBinder.Eval(Container.DataItem, "Narrative") %>
</asp:TextBox>
</EditItemTemplate>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top