Edit selected custom object properties at run time - c#-4.0

I have a requirement in which i should read all the property of the class and display them in UI and the user should be able to edit them and again save the edited property values to the same object. The custom object may have one or more custom type with in it. So i need to allow the user to edit those object properties referred in the parent object too. Suggest an approach to do the above requirement.
Thanks in advance.

You can use the same control that Visual Studio uses for it's UI editor: the ProperyGrid.
It does exactly what you want, see Getting the Most Out of the .NET Framework PropertyGrid Control

Related

Content type fields+customXMLParts+ document custom properties

I have associated my custom content type with my document library in sharepoint, and each content type is connected with a template.
Is there a way that I can access content fields values with 'office js' so that I can update my content fields values by code?
I tried 'CSOM', I can access the fields and can edit, however when I save I got error message saying the document is in use or is locked by another person.
Note: with 'context.document.properties' I can only access the buildin properties while with 'context.document.properties.customproperties' I can only access 'ContentTypeId'.
Please someone share some lights, thanks!
ctfields show up in document properties
The question is not clearly written to understand what you are looking for. The document library properties don't show up as part of default or custom properties. These are simply key:value pairs defined in the document (built-in or custom). You'd need to look at the custom XML parts to access the SharePoint document library properties that are saved to the document. I'm not very sure about the Word APIs. For that you may need to look under the v1.0 API set to access doc library properties

Magnolia Multivalue Field- start with one option

I have created a multivalue field in a dialog and it looks like this when I initially open the dialog:
Is there any way to have it display the field(s) necessary to create the first option when the dialog first opens? This is how we want it to look:
I have looked through the documentation and I could not find a way to accomplish this, but I thought I would ask before telling the designers 'no.'
Thanks for your help!
You need to customize multivalue field to achieve it.
Create your own field factory by extending info.magnolia.ui.form.field.factory.MultiValueFieldFactory<D> in extended factory override createFieldComponent() and once field is initialized (e.g. by calling super.createFieldComponent()) you can add the first option you wanted programatically.
You might have to also tweak transformer or saving of the field to not save empty option if it doesn't do that already ootb.

Is there Java/SSJS equivalent of #AttachmentModifiedTimes?

I want to show list of attachments and FileDownload control is not an option (need custom actions for every file).
To get name and size of attachments there are properties of EmbeddedObject. AFAIK, to get modified time of attachment there is only one option: to use pure #Formula, either via session.evaluate or view containing column with #AttachmentModifiedTimes.
Is there a way (Java/SSJS) to get attachment's modified (and created) time without native #Formulas? That means date stored with file shown in document properties for $FILE item.
You can add a Repeat Control to the page and bind that to the attachments (stored in a rich text field) using document1.getAttachmentList("rt_field_name"). Every item in that list is an object of class
com.ibm.xsp.model.domino.wrapped.DominoDocument$AttachmentValueHolder
That class has a getLastModified() method that returns the last modified time as a Double.
A couldn't find a reference on the web showing the full API, but if you use the API Inspector in the XPage Debug Toolbar (sorry for the shameless plug...) you can view all properties and methods using:
getComponent( 'id_of_repeat_control' ).getDataModel().getRowData()
UPDATE
Found the API here,
I am not 100% sure what you want to achieve.
In general you can use #AttachmentModifiedTimes() - as well as #AttachmentNames() - as SSJS.

Adding custom properties in CodedUI Test builder

I want to add custom properties of my control to CodedUI test builder. How can i achieve it?
I have used Automation provider to implement support for codedUI test in the control().Only the properties returned by the AutomationElementIdentifiers are visible in the assert window now, what should i do to include the other custom properties in it?
Please guide me to resolve this.
Thanks
The following is an example of adding custom properties to a link, but it applies to any other control.
HtmlHyperlink myLink;
myLink.SearchProperties.Add("InnerText", "Custom Inner Text", PropertyExpressionOperator.EqualTo);
I have never actually used the following and not sure if it even applies to coded-ui, but I know it exist.
myLink.SetProperty("PropertyName", "Something");
Thank you for your suggestion, unfortunately it doesn't works.
Finally i realize what is happening in my case, While using Automation Provider in a custom Control(like Grid) we can select the cells and can return only the properties supported by the AutomationElementIdentifiers, it is not possible to return the custom properties of the control to the test builder.
In case of control type i can return only the controltypes comes under the AutomationIdentifier.
So for my grid cell i used ControlType.Edit, but its not much helpful, the values in the Grid cells are not returned. So i decided implement the CodedUI support for my control as described in MSDN .
Thanks
Kalai

How to add a property an ASP.Net user control or web page and have that property read by Microsoft coded-ui testing? (CUIT)

I am using Microsoft coded-ui testing (CUIT) in VS 2010 Ultimate to test an ASP.Net 4.0 site.
I have the source code to the ASP.Net site, so I can modify it as needed.
I've got record/playback working.
I can write simple assert statements in the test methods to check properties of the UITestControl descendents (HTML links, tables, etc.) and compare them to expected values.
I want to add properties to user controls (ASCX's) and pages in my site, to pass back useful values to the testing code.
For example, I have a user control that implements a menu which displays different sets of menu items depending on the role of the current user.
Rather than having the test script click at the various menu items to check whether or not they're present, I want to add a property to the user control. This property will return info to the caller, listing the menus and menu items present.
I've found info on the Net on how to do this in WinForms, but this code relies on accessability, which I believe is only useful for CUIT with WinForms. Likewise, I've found info on how to do it with WPF/SL.
The answer may be related to getting the UITestControl.NativeElement property, then calling a method that overrides GetProperty(), but I haven't been able to get this approach to work.
Can anyone provide a short code sample showing how to add a property to an ASCX or ASPX page, where that property can be written in C# code-behind, and read by Microsoft Coded UI Testing (CUIT) code?
Thanks!
Adam Leffert
http://www.leffert.com
I haven't found an answer to this question, but I have written some code to solve the underlying problem.
I realized that adding properties to user controls would keep the validation data together with the control under test, but only for the case where the section of UI was implemented as a user control.
There are at least two other cases I need to cover:
1) Third-party controls added to the page, for example ASPxGridView, ASPxTreeView, etc.
2) Items that are not visible in the UI, for example the user profile data for the current user.
When you're running CUIT validation code with a Web app, the data you have available is DOM data, i.e. a tree that represents the contents of the Document Object Model of the contents of the browser window. There is no Request object, .Net Page object, etc. This DOM data is accessible through the UIMap object.
I don't want to wrap the third-party controls in user controls, because doing so would disturb the application under test, causing me to re-write the application code that touches properties and events of the grid, tree view, etc. Too intrusive for testing code.
So I created a code interface (ITestable) that contains a dictionary of string values, and a list of ITestable children.
In the LoadComplete event handler of the master page, I create an ITestable for the master page and fill the list with child ITestable objects for the child page, which can themselves contain lists of children.
I serialize this object into JSON, then store it in a hidden field on the master page.
I added the hidden field to the UIMap.
The test validation code deserializes the ITestable, then looks through it for values that need validation.
The controls create their own ITestable objects, so they can easily fill the objects with values that may be needed for validation, rather than forcing the test code to manipulate the UI trying to read validation values.
For example, a tree view could return its contents without the testing code having to click on each node and try to read the value displayed there. Additional properties (visible, enabled, etc.) can be stored in the values dictionary for each ITestable object.
CUIT has some very powerful features. I would very much appreciate it if Microsoft would document some best practices for solving these non-trivial validation problems. I've read through the Microsoft documentation but haven't found much on this topic for Web apps.

Resources