C# notes 1

1. Ajax ActionsLinks allows to submit request in an asynchronours manner,  it updates a section without doing a whole page submit.

    eg.

<div id="dailydeal">
       //Arguments: 1.link text, 2. method in action class, 3. ajax behavior setting
      @Ajax.ActionLink("Today's special!", "DailyDeal", new AjaxOptions {

                  UpdateTargetId = "dailydeal",

                  InsertionMode = InsertionMode.Replace,

                  HttpMethod = "GET"

              })

</div>

2. Unobotrusive java script is used to seperate javascripts code from html content. Ajax.ActionLink method generates <a> tags with data-dash attributes. Although these attributes will be ignored by browser, they will be

  analysed by unobtrusive java script functions.

eg.

   <a data-ajax="true" data-ajax-method="GET"  data-ajax-mode="replace" data-ajax-update="#dailydeal" href="/Home/DailyDeal">

   Today's special!

  </a>

 


 

posted on 2013-08-04 13:21  windrainer  阅读(138)  评论(0)    收藏  举报

导航