Click here to Skip to main content
15,913,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
Trying to add decimal datatype parameter to  EntityDataSource.
 is not working (not filtering results ), not raising error.

Code :
   plu_parametrs += "it.Plu_L_Store=@store_num";
                PLUEntityDataSource.WhereParameters.Add("store_num", TypeCode.Int32,        StoreDropDown.SelectedValue.ToString());

 plu_parametrs += "it.Plu_L_Dept=@dept_id";
  PLUEntityDataSource.WhereParameters.Add("dept_id", TypeCode.Int32, DropDownDept.SelectedValue.ToString());

                plu_parametrs += "it.Plu_L_plu=@txtsearch";
                PLUEntityDataSource.WhereParameters.Add("txtsearch", TypeCode.Decimal, txtsearch.Text);

            PLUEntityDataSource.Where = plu_parametrs.ToString();
            PLUEntityDataSource.DataBind();

ASPX code :

 <asp:EntityDataSource ID="PLUEntityDataSource" runat="server"
        ConnectionString="name=GSEntities"
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True"
        EntitySetName="plulookups"
        Where="it.Plu_L_Store=@store_num and it.Plu_L_Dept=@dept_id and it.Plu_L_Margin = @Plu_L_Price" DefaultContainerName="GSEntities" >
        <WhereParameters>
            <asp:ControlParameter ControlID="StoreDropDown" Name="store_num"
                PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter Name="dept_id" Type="Int32" ControlID="DropDownDept"
                PropertyName="SelectedValue" />
            <asp:ControlParameter Name="Plu_L_Price" DefaultValue="100" DbType ="Decimal" ControlID="txtprice" PropertyName="Text"/>
        </WhereParameters>
    </asp:EntityDataSource>
            GridView1.DataBind();

Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900