What is a property and a control in Pega 7.2? - pega

I want to know the difference between controls and properties in PEGA 7.2.

Property is like a variable in Java -
https://pdn.pega.com/sites/pdn.pega.com/files/help_v72/procomhelpmain.htm#rule-/rule-obj-/rule-obj-property/main.htm?Highlight=properties
Controls are used in pega to define how properties appear on UI -
https://pdn.pega.com/sites/pdn.pega.com/files/help_v72/procomhelpmain.htm#rule-/rule-html-/rule-html-property/main.htm
PDN is best source for all pega related definitions

Property is a Data field in general. You can imagine a variable in C or Java. That can be primitive type or complex type. In Pega, property type may be Single or Page, Page List, Object...etc.
Control is a UI component like textbox, button, checkbox, link...etc.
A property can be associated with a control to display in certain format on a user screen.
I would define a property 'CustomerName' and my control to read Customer name is 'TextBox'.

A property stores some value. It is like a box.
Control is a user interface element, which helps your system to get a value from or show it to a customer.
Always, properties and control are used together.
For example, a user fulfills a UI control with theirs name. And the name is assigned to some property.

Related

ASP.NET long Name attribute - Why is there no ClientNameMode

In ASP.NET much has been made about the ClientIdMode property that gives developers greater control over the a control's ID attribute as it appears in the HTML.
However little attention appears to have be paid to the way the controls render their Name attribute. It appears to be a simple concatenation of the control's ID and its hierarchy of naming containers.
Given a sufficiently complex web page these names get very long. They not only make the HTML payload big (and ugly) but are also posted back to the server on every postback. (Also, they make their way into the Control State of some third party control suites. )
Why isn't there a ClientNameMode property - or similar? Surely it is as important as the Id attribute? Is it possible to override some method that generates / rehydrates the Name attribute so that we can man handle it to maybe match the Id? (made shorter by the ClientIdMode)
An example of a name of a control on a page that I am working on is
USoWAR1_tabContainer_UDetailsTabContainer_tabContainer_UDetailsTab_UDetails1_UDueDateAndNotifications1_decDetail_DataEntryRow1_datDueDate_DateTimePicker_calendar_AD
As far as I know the only way to alter this functionality is to extend controls into your own and override UniqueID property (e.g. by returning Server-side ID).
I had this same issue, and had to use JS to set the attr after loading.
$('#idofdomobjiwanttoname').attr("name", "whatIWantToNameIt");

How is the 'name' attribute calculated in ASP.NET?

Im trying to understand how the 'name' attribute works for elements in markup rendered via ASP.NET
I.e. <select id="lblxyz" name="ctl00$c$ctl341$lblxyz">
What are ctl00, c and ctl1341?
If I create a WebControl, give it an arbitrary id, then place a Button inside its Controls collection, the name attribute does not seem to reflect the container's id?
The key thing as you have discovered is that not all controls trigger this behaviour. The key is the INamingContainer interface. Only Naming Containers will contribute to the name of the control as you have seen, other controls won't.
The MSDN page linked above says it pretty well: that interface "identifies a container control that creates a new ID namespace within a Page object's control hierarchy."
The generated name attribute typically always starts with ctl00, and the rest is generated based on where the control lives in the control hierarchy. Any parent controls implementing the INamingContainer interface will contribute to the names generated for any child controls.
This may be of interest to you, it outlines out the id/names are generated: http://www.mostlylucid.net/archive/2008/11/03/way-too-much-information-on-control-ids-and-asp.net-4.0.aspx
You can control how the client ID appears using the new ClientIDMode:
All about Client ID Mode in ASP.NET 4

ASP.Net TextBox.AutoCompleteType property - useful? customizable?

The ASP.Net TextBox control has an AutoCompleteType property that takes an AutoCompleteType enumeration value.
First, is this property commonly used in actual development? Or is "browser autocomplete" turned off and Ajax autocomplete used instead?
Second, are you constrained to only the values in the AutoCompleteType enum? Can you extend the AutoCompleteType enum to contain custom values?
The AutoCompleteType enum is merely a simple way of referencing the autocomplete expando attribute exposed by the html tag. This attribute can be any string, with "off" being reserved for disabling the feature. Any textboxes that use a specific string will start autocompleting from the same shared list of previous entries.
For example:
If you set autocomplete on 2 boxes to "car", the next time you visit a form with another box with autocomplete set to "car" your previously used choices will become available.
Setting autocompletetype="disabled" didn't actually turn off auto complete in Firefox. The only time autocompletetype works is when the client is using IE. (Yay asp.net browser sniffing.)
Using the non-standard attribute autocomplete="off" works -- and you can use this in your markup instead of using setattribute().

List of themeable / skinable properties for ASP.NET controls?

Does anyone know how or where I can find a list of properties that can be defined in a skin file for standard ASP.NET controls?
Thanks
I believe that every property is, by default, Themeable. But, a number of properties are marked with the Themeable(false) attribute. For example, an asp:Button has its OnClientClick property marked Themeable(false).
Don't know how to get this list up front though. You'll get an error when you view a page and a Skin file tries to set a non-Themeable property.
In my experience, you can set all properties of all controls. I just made a small test, I found that it's even possible to define the items to be displayed in a ListBox in the skin file.

How to create a custom ASP.NET control with automatic validation

I am building an ASP web site that contains a large section that represents a database front end. I need to build forms to manipulate the database and obviously there would be much repitition i.t.o the type of input field and rules pertaining to the field. For example there are many tables where I have take on varchar(n) fields that could be required or not.
I was thinking to build a set of custom controls that would contain a label naming the field, an edit control (text box for example) and validators for the edit control. The custom control should automatically get the field length and set the MaxLength property as well as determine if the field is a required one and ad a RequiredFieldValidator etc. So when I create the custom control I would do something like this:
<user:UserControls_TextFieldEdit LinqObjectType="Franchise" FieldName="FranchiseName" runat="server" />
There must be a way to achieve this but I haven't I been able to find any controls/libraries that do this. I don't know how to get the field information armed with only strings representing the Linq entity name and field name.
Any help/suggestions would be appreciated.
I am using ASP.NET 3.5 and Linq.
Thanks,
Gerhard
Is Dynamic Linq what you need?

Resources