ASP.NET DaST

DaST-logo-3 DaST is a new architectural pattern for building highly dynamic Web 2.0 applications. A web page is rendered as a set of randomly nested rectangles where each rectangle is controlled individually and every combination of rectangles can be partially updated via AJAX. DaST is designed to make web development  more natural and intuitive, without complexity that other known frameworks have. Quick overview

Find more on the NEW project site at www.Makeitsoft.com

LATEST NEWS & EVENTS

First impression …

Here is a basic demo of simple output app with DaST. It does not do much, just outputs some customer-order-item data in the user friendly form. So, how does this app look in the DaST world?

First, we need an HTML template with 3 repeater scopes to control presentation. DaST templates contain nothing but regular HTML:

<div dast:scope="CustomerRepeater" class="indent">
  <b>Customer:</b>&nbsp;{CustomerName}
  <div dast:scope="OrderRepeater" class="indent">
    <div><b>Order:</b>&nbsp;{OrderID}</div>
    <div dast:scope="ItemRepeater" class="indent">
      <div><b>Item:</b>&nbsp;{ItemName}</div>
    </div>
  </div>
</div>

Then, we need to implement a controller class with callbacks to individually control every repeater scope in the template - there are 3 callbacks for each of the scopes:

public class NonsenseExample1aController : ScopeController
{
  private void DataBind_CustomerRepeater()
  {
    var customers = DataLayer.GetCustomers(); // get all customers

    CurrPath().RepeatStart(); // zeroize repeater
    foreach (var c in customers) // loop through customers
    {
      CurrPath().Repeat(); // repeat scope for current customer
      CurrPath().Replace("{CustomerName}", c.GetValue("Name")); // bind customer name
      CurrPath("OrderRepeater").Params.Set("CUST", c); // pass customer to next scope
    }
  }

  private void DataBind_OrderRepeater()
  {
    var c = CurrPath().Params.Get<object>("CUST"); // customer passed in params
    var orders = DataLayer.GetOrders((string)c.GetValue("Name")); // customer orders

    CurrPath().RepeatStart(); // zeroize repeater
    foreach (var o in orders) // loop through orders
    {
      CurrPath().Repeat(); // repeat scope for current order
      CurrPath().Replace("{OrderID}", o.GetValue("ID")); // bind order id
      CurrPath("ItemRepeater").Params.Set("Order", o); // pass order to next scope
    }
  }

  private void DataBind_ItemRepeater()
  {
    var o = CurrPath().Params.Get<object>("Order"); // order passed in params
    var items = DataLayer.GetOrderItems((string)o.GetValue("ID")); // order items

    CurrPath().RepeatStart(); // zeroize repeater
    foreach (var i in items) // loop through items 
    {
      CurrPath().Repeat(); // repeat scope for current item
      CurrPath().Replace("{ItemName}", i.GetValue("Name")); // bind item name
    }
  }
}

This is it! The resulting output in the web browser is like this:

littlenonsense-ui-1

This example is very basic and does simple output only. The real power of DaST pattern shows in highly dynamic and interactive Web 2.0 apps with heavy AJAX load. Please go through our Getting Started tutorial to see all this in action.

Looking at the example above you might have one question: WHAT HAPPENED? How did it work? Where are all server controls? Where are repeaters with data binding expessions, labels, update panels, and my lovely page lifecycle events? Something’s got to be wrong, there’s got to be catch somewhere!? … NO, there is no catch, it's just the way DaST works. And no matter how complex and dynamic your Web 2.0 page is, your controller class will essentially have the same plain structure as the one above! How this works?

Check out DaST technology Quick Overview or full Getting Started tutorial to learn more.

Last edited Mar 26, 2013 at 6:39 AM by rgubarenko, version 98