Component TokenWebInput
TokenWebInput Component
This control is meant to display field in TreeView or DropdownTree.
For example;
Following screenshot shows the control in DropdownTree format.
Following screenshot shows the control in Treeview format
Properties (cosmetic properties are excluded)
Property Name |
Type |
Remark |
Feature_AutoHideRemark |
Bool |
System will display or hide the remark by default. If the value is true, system will not show remark automatically, until user select the node. |
RemarkInputType |
enumTokenInputRemarkType |
The type of input in remark. |
AllowOptional |
Bool |
If optional is allowed, add blank token. |
Autopostback |
Bool |
Trigger auto postback if there’s any change |
UniqueGuid |
String |
Not in used? |
UniqueName |
String |
Not in used? |
ControlType |
enumTokenInputWebControlType |
Set whether it is TreeView or DropdownTree |
Mode |
enumTokenInputWebControlMode |
View or Edit mode. |
AllowCheckbox |
Bool |
If it’s true, system will display checkbox |
AllowMultiSelect |
Bool |
If it’s true, system allow user to multi-select node |
AllExpand |
Bool |
If it’s true, system will automatically expand all the tree nodes |
CheckChildNodes |
Bool |
If it’s true, system will automatically check all child nodes when parent is checked |
TriStateCheckbox |
Bool |
Whether to enable TriState |
CloseOnDropdown |
Bool |
Whether to automatically close when selecting dropdown |
Methods
Method Name |
Type |
Remark |
Refresh |
Void |
To reload the data, and refresh the control |
getSingleSelectedValue |
Int? |
If the control accept only one selected node, call this function to get the selected value. If control has multiple selection, system will only get the very first selected node |
getSingleSelectedToken |
AccountToken |
Same as getSingleSelectedValue, but it return AccountToken instead |
getSelectedText |
String |
Get all selected tokens, and display in comma separated value. |
getSelectedRemark |
String |
Get all selected tokens, and get all the remarks |
getTreeByGUID_fromCache |
List<AccountToken> |
Get the list of child tokens based on parent GUID |
getTreeByName_fromCache |
List<AccontToken> |
Get the list of child tokens based on parent unique name |
getSelectedTokensFromInput |
List<AccountToken> |
Get all selected token and remarks from the current input controls. Use this before saving the record. |
getSelectedNodes |
IList<RadTreeNode> |
Get the selected nodes |
|
|
|
Sample codes
Setting up control
In this example, the control is set to DropdownTree (combobox) and assign the Parent Token
//Assign the parent token ctlGamblingActivities.UniqueGUID = “c4460e37-40ec-4a62-89e5-e58ea7aeb3ca”; // set the control type ctlGamblingActivities.ControlType = enumTokenInputWebControlType.TreeCombobox; // show checkbox ctlGamblingActiities.AllowCheckbox = true; // set multi selection ctlGamblingActivities.AllowMultiSelect = true; // render the control ctlGamblingActivities.Refresh() |
Get the control data, and save the token lists
private List<AccountToken> getSelectedValueFromTiwc(UserControl source) { List<AccountToken> result = null; TokenInputWebControl tiwcInput = source as TokenInputWebControl; result = tiwcInput.getSelectedTokensFromInput(); return result; } List<AccountToken> selectedTokens = new List<AccountToken>(); selectedTokens.AddRange(getSelectedValueFromTiwc(tiwcReferralType)); // You will need to keep the Selected Tokens // the getSelectedTokensFromInput() will return ALL the tokens, including the parent of selected Token. // store this Selected Tokens information to database List<AccountToken> selected = TokenInputWebControl.getSelectedTokensFromInput(); string strSelected = selected.Where(p => p.Selected).ToList().Select(p => p.TokenID.ToString()).ToList().toCommaSeparatedValues(); Record.Selected=strSelected; // save it somewhere in record |
// assuming the strSelected is the CSV we retrieve from database TokenInputWebControl tiwcCtlHelplineType = tiwcControl(tiwcHelplineType_Source); tiwcCtlHelplineType.Selected = strSelected; // only selected ones (no parent) tiwcCtlHelplineType.SelectedTokens = SelectedTokens; //including parents tiwcCtlHelplineType.Refresh(); |