Hi,
The problem I'm having is similar to the one addressed in this thread:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=8256
However, I'm having a problem with the update using a FormView. The code is:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="City.aspx.cs" Inherits="Admin_City" Title="Untitled Page" %>
<%@ Register Assembly="SD.LLBLGen.Pro.ORMSupportClasses.NET20" Namespace="SD.LLBLGen.Pro.ORMSupportClasses"
TagPrefix="llblgenpro" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:FormView ID="fvCity" runat="server" DataKeyNames="CityId" DataSourceID="LLBLGenProDataSource1">
<EditItemTemplate>
<table class="CanyonDigital">
<tr class="RowStyle">
<td class="HeaderStyle">
City:
</td>
<td>
<asp:TextBox ID="City" runat="server" Text='<%# Bind("City") %>'>
</asp:TextBox>
</td>
</tr>
<tr class="RowStyle">
<td class="HeaderStyle">
State:
</td>
<td>
<asp:DropDownList ID="stateID" runat="server" DataSourceID="llblgenDS2" DataTextField="state" DataValueField="stateID" AutoPostBack="True" SelectedValue='<%# Bind("StateId") %>'>
</asp:DropDownList>
<llblgenpro:LLBLGenProDataSource id="llblgenDS2" runat="server" DataContainerType="EntityCollection"
EntityCollectionTypeName="DAL.CollectionClasses.StateCollection, App_Code.i0dy4x_t">
</llblgenpro:LLBLGenProDataSource>
</td>
</tr>
<tr class="RowStyle">
<td class="HeaderStyle">
County:
</td>
<td>
<asp:DropDownList ID="countyID" runat="server" DataSourceID="llblgenDS3" DataTextField="county" DataValueField="countyID" SelectedValue='<%# Bind("CountyId") %>' EnableViewState="false">
</asp:DropDownList>
<llblgenpro:LLBLGenProDataSource id="llblgenDS3" runat="server" DataContainerType="EntityCollection"
EntityCollectionTypeName="DAL.CollectionClasses.CountyCollection, App_Code.i0dy4x_t">
<selectparameters>
<asp:ControlParameter PropertyName="SelectedValue" Name="StateId" ControlID="stateID"></asp:ControlParameter>
</selectparameters>
</llblgenpro:LLBLGenProDataSource>
</td>
</tr>
<tr>
<td>
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update">
</asp:Button>
</td>
</tr>
</table>
</EditItemTemplate>
</asp:FormView>
<llblgenpro:LLBLGenProDataSource id="LLBLGenProDataSource1" runat="server" DataContainerType="EntityCollection" EntityCollectionTypeName="DAL.CollectionClasses.CityCollection, App_Code.sbnhhox3" >
<selectparameters>
<asp:QueryStringParameter Name="CityId" QueryStringField="cityID"></asp:QueryStringParameter>
</selectparameters>
</llblgenpro:LLBLGenProDataSource>
</asp:Content>
I want the State Drop-Down to filter what Counties display in the drop-down below it. The page loads properly (displaying the city/state/county) I am editing, but if I change the State drop-down, I get the error: "System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
I think it has to do with SelectedValue because if I take that part out, it works without error, however, it doesn't bind the data in when the page is loaded, nor does it put those values into the Database when the update is fired.
Any help would be greatly appreciated...