05-19-2015 02:11 PM
06-16-2015 11:06 AM
This is how we are getting the binary to send to editlist in the application:
var url = AppPath + '/Dialogs/EditList.aspx?ac=' + document.getElementById(ActiveControl).getAttribute("binary");
I hope this helps!
06-16-2015 01:10 PM
That's because your 'binary' attribute is generated from Act's internal layout designer.
I have my own layout designer which I do not want to port to HTML today
This is the workaround I came up with.
Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn '// Get the Container control Dim cContainer As DevExpress.Web.TemplateContainerBase = CType(container, DevExpress.Web.TemplateContainerBase) ' Add a multiselect list Dim lstPickList As DevExpress.Web.ASPxListBox = New DevExpress.Web.ASPxListBox lstPickList.Attributes.Add("ACTField", Me.ACTFieldDescriptor.DisplayName ) Dim IsEditable As Boolean = False Dim isAutoInsert As Boolean = False Dim IsMultiSelect As Boolean = False Dim IsLimitToList As Boolean = False Dim ShowDescription As Boolean = False Dim binaryString As String = "" 'CustomSubEntity.ConverFieldNameToBinaryString("State") Try '-------------------------------------------------------- ' Clear the current list '-------------------------------------------------------- lstPickList.Items.Clear() '------------------------------------------------------------------------- ' Does this field have a pick list '------------------------------------------------------------------------- If Not Me.ACTSessionManager.Framework.PickLists.GetPickLists(Me.ACTFieldDescriptor) Is Nothing Then '-------------------------------------------------------- ' Load the picklist values for type into the combo box. '-------------------------------------------------------- Dim pickList As Act.Framework.PickLists.PickList pickList = Me.ACTSessionManager.Framework.PickLists.GetPickLists(Me.ACTFieldDescriptor) If Not (pickList Is Nothing) Then binaryString = CustomSubEntity.ConverFieldNameToBinaryString(Me.ACTFieldDescriptor.Name) '"Q1VTVF9TdG9ja1RyYWNrZXIuQ1VTVF9UeXBlXzEwMzc0OTU4Mw==" String IsEditable = pickList.IsEditable isAutoInsert = pickList.IsAutoInsert Select Case pickList.Name Case "Employees/User" For Each singleUser As Act.Framework.Users.User In Me.ACTSessionManager.Framework.Users.Users '---------------------------------------------------- ' Add items to the picklist. '---------------------------------------------------- lstPickList.Items.Add(singleUser.DisplayName, singleUser.DisplayName) Next Case Else If IsLimitToList = True Then ' PickListAttribute.IsLimitToList = True Then 'add a blank so the user can roll-back lstPickList.Items.Add("", "") End If For Each item As Act.Framework.PickLists.PickListItem In pickList.Items ' Are we showing the description in the dropdown If ShowDescription = True Then 'PickListAttribute.ShowDescription Then lstPickList.Items.Add(item.ToString(), item.Description.ToString()) Else lstPickList.Items.Add(item.ToString(), item.Value.ToString()) End If Next End Select '------------------------------- ' Get the pickListAttributes '------------------------------- Dim ACTPickListAttribute As Act.Framework.Database.PickListAttribute Dim DataBaseFieldDescriptor As Act.Framework.Database.FieldDescriptor DataBaseFieldDescriptor = CustomSubEntity.GetFieldDescriptorFromCustomFieldDescriptor(Me.ACTSessionManager.Framework, Me.ACTEntityManager, Me.ACTFieldDescriptor) ACTPickListAttribute = Me.ACTFieldDescriptor.Attributes(Act.Framework.Database.FieldProperty.PickList) If Not (ACTPickListAttribute Is Nothing) Then IsLimitToList = ACTPickListAttribute.IsLimitToList IsMultiSelect = ACTPickListAttribute.IsMultiSelect ShowDescription = ACTPickListAttribute.ShowDescription End If End If End If Catch ex As Exception ' DO nothing End Try lstPickList.Width = System.Web.UI.WebControls.Unit.Percentage(100D) If IsMultiSelect Then lstPickList.ClientSideEvents.SelectedIndexChanged = "function(s,e) {OnCheckBoxSelectionChanged(s,e," + Me.ClientInstanceName + ");}" Else lstPickList.ClientSideEvents.SelectedIndexChanged = "function(s,e) {OnListBoxSelectionChanged(s,e," + Me.ClientInstanceName + ");}" End If cContainer.Controls.Add(lstPickList) '---------------------------------------------------------------------------- ' Add the EDIT button if the user is allowed to edit this picklist '---------------------------------------------------------------------------- If IsEditable And Not (binaryString = String.Empty) Then Dim btnEdit As DevExpress.Web.ASPxButton = New DevExpress.Web.ASPxButton() btnEdit.Text = "Edit" btnEdit.HorizontalAlign = WebControls.HorizontalAlign.Left btnEdit.ClientSideEvents.Click = "function(s,e) { EditPicklist('" + binaryString + "');}" btnEdit.AutoPostBack = False container.Controls.Add(btnEdit) End If End Sub
Here is the Binary converters
Public Shared Function ConverBinaryStringTo(ByVal binaryString As String) As String Try Dim bytes As Byte() = Convert.FromBase64String(binaryString) Dim encoding As New Text.UTF8Encoding Return encoding.GetString(bytes) Catch ex As Exception Throw ex End Try Return String.Empty End Function Public Shared Function ConverFieldNameToBinaryString(ByVal binaryString As String) As String Try Dim byt As Byte() = System.Text.Encoding.UTF8.GetBytes(binaryString) Return Convert.ToBase64String(byt) Catch ex As Exception Throw ex End Try Return String.Empty End Function
And here is the jScript
function EditPicklist(BinaryPickListName) { try { var url = AppPath + '/Dialogs/EditList.aspx?ac=' + BinaryPickListName; var ModalReturnValue = ActModalDialog(url, this, 334, 516); if (ModalReturnValue != undefined && ModalReturnValue != "" && typeof (ModalReturnValue) != "object" && ModalReturnValue != null && ModalReturnValue != 'DialogResult.Cancel') { var oControl = document.getElementById(ActiveControl); oControl.value = ModalReturnValue; jQuery(oControl).change(); } } catch (err) { alert("EditPicklist() " + err.message); } }
Hope this can help someone else.
-- Jim Durkin