Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with Details view

0 views
Skip to first unread message

Cirene

unread,
May 10, 2008, 11:01:24 AM5/10/08
to
I have a detailsview control. In theInsertItemTemplate I have 2 cascade
dropdownlists (for category and subcategory). For the 2nd one (subcategory)
I tried to do a databind to a field but I get this error:

Databinding methods such as Eval(), XPath(), and Bind() can only be used in
the context of a databound control.

Any ideas why? Here's part of the html code...

<InsertItemTemplate>
<table class="style3">
<tr>
<td class="style4">
Category:</td>
<td>
<asp:DropDownList ID="ddlCatInsert"
runat="server" AutoPostBack="True"
DataSourceID="sdsCategories"
DataTextField="Category" DataValueField="Id"
>
</asp:DropDownList>
<asp:SqlDataSource ID="sdsCategories"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM
[classifiedCategories] ORDER BY [Category]">
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="style4">
Subcategory:</td>
<td>
<asp:SqlDataSource ID="sdsSubCategories"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM
[classifiedSubcategories] WHERE ([CategoryId] = @CategoryId)">
<SelectParameters>
<asp:ControlParameter
ControlID="ddlCatInsert" Name="CategoryId"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:DropDownList ID="DropDownList1"
runat="server"
DataSourceID="sdsSubCategories"
DataTextField="SubCategory" DataValueField="Id"
SelectedValue='<%# Bind("SubcategoryId")
%>'>
</asp:DropDownList>
</td>
</tr>


Cirene

unread,
May 10, 2008, 11:02:39 AM5/10/08
to
i mean FORMVIEW :)

"Cirene" <cir...@nowhere.com> wrote in message
news:uYpk46qs...@TK2MSFTNGP03.phx.gbl...

0 new messages