What is widget?
Widgets are dynamic web content that you can easily put on the page from the Widgets explorer. Widgets can be games, mini applications, new feeds, flash link, html text or any content. When added to the page it will become a part of the page, it can be moved, closed, imported, exported, customized style by authorized users.
Why widgets?
Develop on DotNetAge will make Mvc, jQuery development more easy that is most important goal of the DotNetAge. DotNetAge propose “Helping developers impalements the good idea as soon as possible”. So DotNetAge provides environments that build and publish ideas immediately. One of the ways you impalements ideas are to create widgets. A site make up of pages, a page make up of widgets, DotNetAge allows peoples to build a site just like play toy bricks by using Widgets.
Take a look in widget
The DotNetAge widget is make of header area, user preferences setting area, content area, and footer area. By default the will not show the verbs, user preferences setting area and footer area they are just show in the page design time.
Create your first widget
Develop Widget is a very easy job. In fact widget is an Action of controller.
At first we need to create the DotNetAge project in VS.NET 2010 you can download the DNA project template from "releases/55099/download/163755
In fact the DotNetAge web project is Mvc 2 web project so there is no diffence from develop Mvc project.
Right click the “Controllers” folder in project and named “WidgetDemoController”
Add a Action method named “HelloWorld” then add “DNA.Mvc.DynamicUI.WidgetAttribute” on the top the Action method – developers just need to specified the WidgetAttribute class on top of the target action that the Action will become a Widget. Developer just uses WidgetAttribute class and PropertyAttribute class to define a Widget. The Widget development is same as Action development in Mvc.
We need the view to rend the widget add the View for this Action.
Add the text “Hello wrold” in the view we created.Now press “F5” to run the project and using “administrator” account login DotNetAge then click “SiteTools->Design this page->Add content”
DotNetAge will auto detected the the widget category and create a new tab for your HellWord widget so click the “Demo” tab and select the “HelloWorld” widget icon a preview dialog will show.
By default you should preview the widget before you add to page,select the widget zone where you want to place the widget and click the “Add to page”.
OK that’s all! Easy and simple for Mvc developers!
-
-
阅读(4967)
-
固定链接