Hello!
I'm starting with ListView and I have a problem using DropDownLists in the InsertItemTemplate. I have the code as follows:
<asp:DropDownList ID="DropDownList3" runat="server" AppendDataBoundItems="True" DataSourceID="LinqDataSource4" DataTextField="Disciplina" DataValueField="Cod" SelectedValue='<%# Bind("Cod") %>' >
SelectedValue='<%# Bind("Cod") %>' >
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem></asp:DropDownList>
</asp:DropDownList><asp:LinqDataSource ID="LinqDataSource4" runat="server" ContextTypeName="DSIDigitalDataContext" OrderBy="Disciplina" Select="new (Cod, Disciplina)" TableName="Unidades_SAs">
<asp:LinqDataSource ID="LinqDataSource4" runat="server" ContextTypeName="DSIDigitalDataContext" OrderBy="Disciplina" Select="new (Cod, Disciplina)" TableName="Unidades_SAs">
Select="new (Cod, Disciplina)" TableName="Unidades_SAs"></asp:LinqDataSource>
</asp:LinqDataSource>and I get the following error when I start the app:
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.
In the same ListView I use a similar DropDownList in the EditItemTemplate and I have no problem.
I'll appreciate your help.
Sorry if this is not the correct place to speak about this issue.
Regards.
António