我在 DetailsView 中有两个下拉列表,我想级联工作,想法是一个区域包含各种问题,这些问题取决于所选区域,但我收到以下错误:
Eval()、XPath() 和 Bind() 等数据绑定方法只能在数据绑定控件的上下文中使用。
在下一行:
<asp:DropDownList ID="ddlIssue" runat="server"
DataTextField="NameIssue" DataValueField="IdIssue"
完整的代码是:
<asp:TemplateField HeaderText="Area" SortExpression="IdArea">
<EditItemTemplate>
<asp:DropDownList ID="ddlArea" runat="server"
DataSourceID="SqlDataSource145711" DataTextField="NameArea"
DataValueField="IdArea" AutoPostBack="true"
AppendDataBoundItems="true" SelectedValue='<%# Bind("IdArea") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource145711" runat="server"
ConnectionString="<%$ ConnectionStrings:BaseDatosCJConnectionString %>"
SelectCommand="SELECT IdArea, NameArea FROM AREA">
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server"
Text='<%# Bind("IdArea") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Issue">
<EditItemTemplate>
**<asp:DropDownList ID="ddlIssue" runat="server"
DataTextField="NameIssue" DataValueField="IdIssue"**
DataSourceID="SqlDataSource22" SelectedValue='<%# Bind("IdIssue") %>'
</asp:DropDownList>
<asp:SqlDataSource runat="server"
ID="sqlDataSource22"
ConnectionString="<%$ ConnectionStrings:BaseDatosCJConnectionString %>"
SelectCommand="SELECT IdIssue, NameAIssue, IdArea FROM ISSUE"
FilterExpression="IdArea = '{0}'">
<FilterParameters>
<asp:ControlParameter Name="Param" ControlID="ddlArea"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
</EditItemTemplate>
</asp:TemplateField>
你能帮忙解决这个错误吗?
我必须从代码中做些什么?
祝福