DropDownList filter does not work with GridView

Posts   
 
    
sbense
User
Posts: 55
Joined: 24-Jul-2007
# Posted on: 03-Aug-2007 17:31:10   

I have tried to implement the sample video example on databinding with the LLBLGenProDataSource2 using a gridview and a dropdownlist.

Basically the grid just will not filter on the selected dropdownlist value, although it does retrieve the EntityCollection correctly. This is an ASP.NET VS2005 web application project.

Am I missing something obvious here? Thanks


<asp:DropDownList AutoPostBack="true" ID="ddlAccount"  runat="server" DataTextField="AccountId" DataValueField="AccountId">
            <asp:ListItem>6</asp:ListItem>
            <asp:ListItem>3178</asp:ListItem>
            <asp:ListItem>3179</asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  DataKeyNames="AccountId" DataSourceID="LLBLGenProDataSource2_1">
            <Columns>
                <asp:BoundField DataField="AccountId" HeaderText="AccountId" ReadOnly="True" SortExpression="AccountId" />
                <asp:BoundField DataField="AccountCode" HeaderText="AccountCode" SortExpression="AccountCode" />
            </Columns>
</asp:GridView>
<llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSource2_1" runat="server" 
        AdapterTypeName="DAL.DatabaseSpecific.DataAccessAdapter, DALDBSpecific"
        DataContainerType="EntityCollection" 
        EntityFactoryTypeName="FactoryClasses.TblAccountEntityFactory, DAL">
            <SelectParameters>
                <asp:ControlParameter ControlID="ddlAccount" DefaultValue="6" Name="newparameter"
                    PropertyName="SelectedValue" />
            </SelectParameters>
</llblgenpro:LLBLGenProDataSource2>

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Aug-2007 10:05:00   

Be sure that the parameter name has the same name as a field in the entity, typed list row or typed view row...

David Elizondo | LLBLGen Support Team
sbense
User
Posts: 55
Joined: 24-Jul-2007
# Posted on: 07-Aug-2007 15:13:15   

Thank you. That was it! The parameter name is the name of the Entity field - usually a PK filed - in your DAL entity class.

To me it wasn't obvious - it would be nice if the designer allowed a drop down of the available fields from the underlying entity for the parameter Name, in the same way the you can select the PropertyName to take the value of from on the filter control.