Welcome Guest! To enable all features please Login or Register.



How to map a logical type to a Web control
#1 Posted : Sunday, September 2, 2012 6:01:03 PM(UTC)

In order to support generation of ASP.NET web forms, the logical types of the parameters that are used to generate the form fields should be mapped to a corresponding ASP.NET web control. There could be different mappings for different scenarios, e.g. when the field may allow multiple values or a single value, so that the most appropriate control can be used, such as a ListBox vs. a DropDownList.

Normally if you extend your logical type from another base type in the model, it will automatically inherit the mapping to the ASP.NET web controls from its parent. If your type does not extend any other logical type, or you just want to override the mapping to the ASP.NET web controls, then the following steps outline this process.
  1. Make sure that the module element that contains your logical type declares a prefix for the "http://www.xomega.net/ui" namespace, e.g. xmlns:ui="http://www.xomega.net/ui"
  2. Add a ui:web-control element inside of the config element of your logical type definition. In the absence of such element your logical type will just inherit the ASP.NET web control from its base type if one exists.
  3. If your control should be used only when the property supports multiple values being selected or entered, then set the multi-value attribute to true.
  4. If your control should be used in data grids instead of a generic label, then set the use-in-grid attribute to true. For example, if a certain key field should be displayed in grids as a hyperlink to the details page for the corresponding object rather than just a label, then you can specify it here.
  5. Inside the ui:web-control element add the XML definition of the ASP.NET control in the namespace xmlns:asp="clr-namespace:System.Web.UI.WebControls" with all the attributes as needed.
  6. To validate your setup find a parameter that uses your logical type and is included in generation of a ASP.NET web form, and then generate the form and check the control used for the corresponding field.

Here is a sample configuration that illustrates these steps.
<module xmlns="http://www.xomega.net/omodel" 
    <type name="invoice type" base="enumeration">
          <asp:DropDownList runat="server"/>
        <ui:web-control multi-value="true">
          <asp:ListBox runat="server"/>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.