ARTICLE

Ajax Enabled Data Application With LINQ

Posted by Davin Martyn Articles | ASP.NET AJAX in VB.NET September 30, 2011
Here you will learn how we can use UpdatePanel control to enable asynchronous postbacks on a page.
 
Reader Level:

Introduction : Ajax Enabled Data Application help we create basic user interface for creating, managing, and deleting lists. All the insert, update, delete,sort and paging operation are inside UpdatePanel control that uses Ajax. We can use UpdatePanel control to enable asynchronous postbacks on a page.

Following task are illustrated for creation of Ajax Enabled Data Application.

  • Create SQL database and add data.
  • Add LinqDataSource control.
  • Add LINQ to SQL Classes.
  • Use ListView control to display, edit,delete, data.

Step : 1 Open Visual Studio -> File -> WebSite.

  • Select ASP.NET WebSite.
  • Default.aspx page open.
ASP-page1.gif

Step : 2 Solution Explorer -> Right -> Click-> Add New Item

  • Select WebForm.
webforms.gif

Step : 3 Create New SQL Server Database.

  • Solution Explorer -> Add New Item.
  • SQL Database.

Step : 4 Create a Schema and Data for the Database.

  • Solution Explorer -> App_Data folder and double click
  • Right-Click in Table folder and then click Add New Table.

Table :

table23.gif

Step : 5
Right-Click the row and click Set Primary Key.

  • Open the Identity Specification section and set (Is Identity) to yes.
  • Server Explorer -> Table -> Right - Click -> Show Table Data.
  • Add record to the table.

  Creating Data Access Controls.

Step : 6 Solution Explorer ->Right-Click-> Add ASP.NET Folder.

  • App_Code-> Right-Click-> Add New Item.
  • Select LINQ to SQL Classes
  • Server Explorer drag Table.

sql1.gif

Creating a LinqDataSource Control.

Step : 7  Switch Default.aspx page.

  • Select Design View option.
  • Drag LinqDataSource Control.
  • Selct Context object -> TaskDataContext.
  • LinqDataSource Task menu.
  • Select Enable Delete, Enable Insert, Enable Update.

sql2.gif

Step : 8 Drag and Drop Data Source Controls.

  • ListView, DropDownList control.
  • Write a code.

Code :

<title></title>
</
head>
<
body>
<
form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <span id ="filter">
    current list filter:
        <asp:DropDownList ID="DropDownList1"  AutoPostBack = "true" runat="server">
        <asp:ListItem Text = "active" Value = "False" />
        <asp:ListItem Text = "complete" Value = "True" />
        </asp:DropDownList>
    </span>
<
hr id = "separator" />
<
asp:LinqDataSource ID="LinqDataSource1" runat="server"
            ContextTypeName="DataClassesDataContext" EntityTypeName="" TableName="Table1s">
        </asp:LinqDataSource>

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
        <asp:ListView ID="ListView1" runat="server" DataSourceID
="LinqDataSource1">
</SelectedItemTemplate>
          </asp:ListView>
          </ContentTemplate>
          </asp:UpdatePanel>
    <div>
    </div>
    </form
>
</body>
</
html>

Step : 9 Add Ajax Functionality to the Page.

  • Drag UpDatePanel,ScriptManager control.

  • Write a code.

Code :

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager
>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate
>
</ContentTemplate>
</asp:UpdatePanel>

Step : 10 Press F5 and run.   

datasource.gif

Login to add your contents and source code to this article
share this article :
post comment
 

Hi, i don't know about the ajax can u please tell me about the slider in ajax and what is the working of slider in ajax?

Posted by Ravi Saklani May 09, 2012

I'm new to VB.net, so bare with me, can this be used to access web pages that use AJAX to read the source with any script updates? Versus just the usual source code that doesn't include any of that, which is easily obtained with httpwebrequest. I'm trying to write a program that can gather prices, products, and such from websites, but they use AJAX so httpwebrequest doesn't grab all the necessary info. Any Suggestions?

Posted by Jason Robinson Jan 24, 2012
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor