Note that there are some explanatory texts on larger screens.

plurals
  1. PODropdownlist filter inside details view
    primarykey
    data
    text
    <p>I have a <strong>drop down list</strong> (very long, over 100 items) inside the <strong>insert item template view</strong> for a details view. I would like to add a text box and button (search feature) so i can filter this list but i get the following 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>I created two entity datasource, one with a where clause and the other one without. When I hit search, the code behind (button click event) switches the datasource to the one with the where clause and parameter but i get the error above. Any advice on how to go about doing this?</p> <pre><code>Dim aa As DropDownList = DetailsView1.FindControl("DropDownList1") aa.DataSourceID = "" aa.DataSource = EmpPersonalInfoLOV1 aa.DataBind() </code></pre> <p>EDITED <strong>Change aa.DataSource from a string to EmpPersonalInfoLOV1 (the name of the datasource)</strong></p> <p><em><strong>EDIT #2</em></strong> More info requested by users..</p> <p><strong>Datasource # 1 Code</strong></p> <pre><code>&lt;asp:EntityDataSource ID="EmpPersonalInfoLOV" runat="server" ConnectionString="name=sspEntities" DefaultContainerName="sspEntities" EnableFlattening="False" EntitySetName="Employee_Personal_Info" EntityTypeFilter="" Select="it.[Emp_id], it.[Employee_No_FastPay], it.[Surname] + ' '+ it.[Firstname] As FullName" Where=""&gt; &lt;/asp:EntityDataSource&gt; </code></pre> <p><strong>Datasource # 2 Code</strong> </p> <pre><code>&lt;asp:EntityDataSource ID="EmpPersonalInfoLOV1" runat="server" ConnectionString="name=sspEntities" DefaultContainerName="sspEntities" EnableFlattening="False" EntitySetName="Employee_Personal_Info" Select="it.[Emp_id], it.[Employee_No_FastPay], it.[Surname] + ' '+ it.[Firstname] As FullName" Where="it.Surname like '%' + @Name + '%'"&gt; &lt;WhereParameters&gt; &lt;asp:ControlParameter ControlID="TxtBx1" DbType="String" DefaultValue="&amp;quot;&amp;quot;" Name="Name" PropertyName="SelectedValue" /&gt; &lt;/WhereParameters&gt; &lt;/asp:EntityDataSource&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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