locked
Dynamic GridView without routing RRS feed

  • Question

  • User-1126886970 posted

    Hi,

     I want to use dynamic data with a gridview without using routing, i.e. in a regular page.

    But i can't figure out how to setup the EntityDataSource. I want to manually do what

    the routing is doing.

    Right now I this code


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Page.aspx.cs" Inherits="WebApplication3.Page" %>

    <%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>

    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server"
    AutoLoadForeignKeys="true"/>

    <asp:EntityDataSource ID="EntityDataSource1" runat="server"
    EnableDelete="true"
    EnableInsert="true"
    EnableUpdate="true">
    </asp:EntityDataSource>

    <asp:GridView ID="GridView1" runat="server" DataSourceID="EntityDataSource1">
    </asp:GridView>

    </div>
    </form>
    </body>
    </html>
     

     

    public partial class Page : System.Web.UI.Page {

    protected void Page_Init( object sender, EventArgs e ) {

    DynamicDataManager1.RegisterControl(GridView1);
    }
    }
     
     
    public class Global : System.Web.HttpApplication {

    void Application_Start( object sender, EventArgs e ) {

    MetaModel model = new MetaModel();

    model.RegisterContext(typeof(AdventureWorksEntities), new ContextConfiguration() { ScaffoldAllTables = true });
    }
    }
      
    Can anyone help me? 
     
    Friday, August 22, 2008 7:25 AM

All replies