I have a ListView control working all nice and neat, bound to a sql data source.
I inserted a second SQL data source to populate a dropdown list within the listview control.
I have the listview control in grid view. On the insertitemtemplate configuration, I am trying to override the text box for "cTypeID" with a dropdown list that has the secondary sql source as its datasource.
You can see from the code below I am trying to get rid of the cTypeIDTextBox and replace it with cTypeDD. It isn't working so I didn't get rid of the textbox yet.
<td><asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" /><asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
<td><asp:Label ID="cIDLabel1" runat="server" Text='<%# Eval("cID") %>' /></td>
<td><asp:TextBox ID="cDateTextBox" runat="server" Text='<%# Bind("cDate") %>' /></td>
<td><asp:DropDownList ID="cTypeDD" runat="server" DataSourceID="CruiseTypes" DataTextField='<%# DataBinder.Eval(Container.DataItem,"tName") %>' ></asp:DropDownList></td>
<td><asp:TextBox ID="cTypeIDTextBox" runat="server" Text='<%# Bind("cTypeID") %>' /></td>
The second SQL Datasource is defined as follows:
<asp:SqlDataSource ID="CruiseTypes" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
SelectCommand="SELECT [tID], [tName] FROM [tbl_Config_Types]"></asp:SqlDataSource>
The error I get is the following:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'tName'.
I know it has this column - I defined it in the query. Why isn't this working?
Thanks in advance for your help