Note that there are some explanatory texts on larger screens.

plurals
  1. POFormview Dropdown 2 depends on Dropdown 1
    text
    copied!<p>I have a form view, in the edit template I have two drop downs. Drop down 1 is explicitly set with a list of allowed values. It is also set to autopostback. Drop down 2 is databound to an objectdatasource, this objectdatasource uses the first dropdown as one of it's parameters. (The idea is that drop down 1 limits what is shown in drop down 2)</p> <p>On the first view of the edit template for an item it works fine. But if drop down 1 has a different item selected it post back and generates an error </p> <blockquote> <p>Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.</p> </blockquote> <p>Here is the drop down list #2:</p> <pre><code>&lt;asp:DropDownList ID="ProjectList" runat="server" SelectedValue='&lt;%# Bind("ConnectToProject_ID","{0:D}") %&gt;' DataSourceID="MasterProjectsDataSource2" DataTextField="Name" DataValueField="ID" AppendDataBoundItems="true"&gt; &lt;asp:ListItem Value="0" Text="{No Master Project}" Selected="True" /&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>And here is the MasterProjectDataSource2:</p> <pre><code>&lt;asp:ObjectDataSource ID="MasterProjectsDataSource2" runat="server" SelectMethod="GetMasterProjectList" TypeName="WebWorxData.Project" &gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="RPMTypeList" Name="RPMType_ID" PropertyName="SelectedValue" Type="Int32" /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre> <p>Any help on how to get this to work would be greatly appriciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload