Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Inserting and Deleting Entity Data with the ListView Control

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 257
    Comment on it

    These are the simple steps for inserting,updating and deleting records in ListView control.

    1. Create new project
    2. Configure entity data model with the project :
      i) Add new item ->Data->ADO.NET Entity Data Model-> add
      ii) Select Generate from database->next
      iii) Click on new connection -> fill server name, select Use SQL Server Authentication, fill username and password, click ok
      iv) Select yes,include the sensitive data in the connection string
      v) Click on finish
    3. Build the project
    4. Drag listView control in aspx page
    5. Click on configure data source select Named Connection and Default ContainerName, click next
    6. Select entity Set Name as table , name of table from which we show information
    7. Check Enable automatic inserts, Enable automatic updates.
    8. Click finish.
    9. Open data source property-> set True in EnableInsert, EnableDelete, EnableUpdate. Here below is the source:

      <asp:listview id="ListView1" runat="server" datasourceid="EntityDataSource1 insertitemposition="LastItem"> </asp:listview> <asp:entitydatasource id="EntityDataSource1" runat="server" connectionstring="name=MvcTestEntities" defaultcontainername="MvcTestEntities" enabledelete="True" enableflattening="False" enableinsert="True" enableupdate="True" entitysetname="EmployeeTests"> </asp:entitydatasource>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: