Installation
ASP.net Web-Forms Awesome Library installation
1) Install NuGet package Microsoft.AspNet.Mvc in your Asp.net Web-Forms project. 2) Download the WebFormsMinSetupDemo open it and use it as guide for the next steps. For VB.NET you can download WebFormsVBDemo. 3) Copy from it and put in the same folders in your solution the following:libs folder: Omu.AwesomeWebForms.dll/xml, Omu.AwemWebForms.dll/xml4) Add reference to
Scripts folder: AwesomeWebForms.js, awem.js, aweUtils.js
Content/themes: copy the "themes" folder into your "Content" folder
Omu.AwesomeWebForms.dlland
Omu.AwemWebForms.dllin your web project. 5) Open
Site.Masterand copy the references to the js and css files ( keep the same order ), and add the call to
Page.Awe().Init(). In the header add
AwesomeMvc.cssand
jquery.js(jquery needs to be in the header for document.ready), and before the </body> add
AwesomeWebForms.js,
awem.js,
aweUtils.jsand call
Page.Awe().Init().
<head>Note: Don't add jquery if you already have it referenced in some other way, for example with a control like this:
...
<link href="<%= ResolveUrl("~/Content/themes/gui3/AwesomeMvc.css") %>" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
...
<script src="<%= ResolveUrl("~/Scripts/AwesomeWebForms.js") %>" type="text/javascript"></script>
<script src="<%= ResolveUrl("~/Scripts/awem.js") %>" type="text/javascript"></script>
<script src="<%= ResolveUrl("~/Scripts/aweUtils.js") %>" type="text/javascript"></script>
<%=Page.Awe().Init() %>
</body>
<asp:ScriptReference Name="jquery" />6) In the main
web.configadd the awe tag prefix:
<system.web>7) In the main web.config add the awesome namespaces:
...
<pages>
<controls>
<add tagPrefix="awe" namespace="Omu.AwesomeWebForms" assembly="Omu.AwesomeWebForms" />
</controls>
<system.web>8) Add the same namespaces in
...
<pages>
...
<namespaces>
<add namespace="Omu.AwesomeWebForms" />
<add namespace="Omu.AwemWebForms.Helpers" />
Views\web.config(for the razor views): (if you don't have
Viewsfolder and
web.configfile in it, create/copy them)
<system.web.webPages.razor>9) Register the MVC routes, in
...
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="Omu.AwesomeWebForms" />
<add namespace="Omu.AwemWebForms.Helpers" />
Global.asax.cscopy (or merge) the
Application_Startmethod:
public class Global : HttpApplicationOptional (You'll need this for the
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// keep default.aspx for empty url
routes.IgnoreRoute("");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start(object sender, EventArgs e)
{
...
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
//Omu.AwemWebForms.Utils.VbNetUtil.AdjustLookupActionNames() // uncomment for VB.NET
}
...
}
Page.Url()extension to be available): 10) Copy the
Utilsand
Helpersfolder, edit the namespaces in the containing cs files to match your project. 11) Add the namespaces for the newly added Utils and Helpers; like in step 7) and 8) add these lines:
<add namespace="YourAppNamespace.Utils" />12) Copy the
<add namespace="YourAppNamespace.Helpers.Awesome" />
Views/Shared/EditorTemplatesfolder and
Views/Shared/Delete.cshtml, if you're following/copying from our demos it is likely that you're going to need them. 13) Try adding a control, in
Default.aspxadd:
<% Con1.Button().Text("hello world").OnClick("awem.notif('hi')"); %>
<awe:Ocon runat="server" ID="Con1" />
hit Ctrl+F514) Add the
Controllersfolder, in it add a class like this:
public class DataController : ControllerIn
{
public ActionResult Foos()
{
return Json(new List<KeyContent>()
{
new KeyContent(1, "hi")
});
}
}
Default.aspxthis code:
<% Dropdown1.AjaxRadioList().Url(Page.Url().Action("Foos", "Data")).Odropdown(); %>
<awe:Ocon runat="server" ID="Dropdown1" />
Hit Ctrl+F5and check the dropdown.
Additional notes
Grid crud icons used in our demos are located in site.css, to use them copy the code between comments/* grid btns */, and the
Content/editdel.png
VB.NET
We have a VB.NET demo that can be downloaded here, you can use this demo as a guide. InGlobal.asax.vb->
Application_Startcall this:
Omu.AwemWebForms.Utils.VbNetUtil.AdjustLookupActionNames()this will change the Lookup.SearchAction for Lookup to "SeachItems", and the MultiLookup.SelectedAction to "SelectedItems", which will avoid the conflict with the parameter name.
Applies to all version