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>
<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
<aspropDownList Runat="server">
<asp:ListItem>Header</asp:ListItem>
<asp:ListItem>Bullet</asp:ListItem>
</aspropDownList>
***** This is where it bombs off **********************
<asp:TextBox Runat="server" ID="txtNarrative">
<%# DataBinder.Eval(Container.DataItem, "Narrative") %>
</asp:TextBox>
</EditItemTemplate>
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>
<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
<aspropDownList Runat="server">
<asp:ListItem>Header</asp:ListItem>
<asp:ListItem>Bullet</asp:ListItem>
</aspropDownList>
***** This is where it bombs off **********************
<asp:TextBox Runat="server" ID="txtNarrative">
<%# DataBinder.Eval(Container.DataItem, "Narrative") %>
</asp:TextBox>
</EditItemTemplate>