Entity Data Source dynamic data RRS feed

  • Question

  • User2027516926 posted

    Hi all,

    i dont wont to give EntityName on aspx page and i want to fill data in EntityDataSource on its event like OnSelecting

    <asp:EntityDataSource ID="EntityDataSource_AllMembers" runat="server" ConnectionString="name=HunchClub_db"
                        DefaultContainerName="HunchClub_db" OrderBy="it.ID" EntitySetName="UserProfiles"


    can any one help me how can i dynamic fill EntityDataSource Object and Than Assing to Grid


    Wednesday, February 1, 2012 2:14 AM


  • User3866881 posted


    There are mainly two ways——

    1)You can handle the EntityFramework's Selecting event,and do a query with the help of LINQ-TO-ENEITY and assign to fetch all the data contents。See sample at:

    protected void BlogDataSource_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
            e.DataSource.Select="Your select statement";

    2)The most fixible way is that you can get rid of EntityDataSource and then do binding to the GridView directly by setting DataSource and call DataBind()。


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 2, 2012 8:02 PM