如何从弹出窗口中获取所选项目的值
问题描述:
我有一个要求,我需要从点击弹出选择器中选择一个人名。之后的电子邮件应该只从弹出选择器发送给选定的人。但我得到了所有人的电子邮件地址而不是那个。以下是我的代码:
Hi,
I have a requirement where i need to select a person name from clicking on Popup picker. And later email should be sent only to the selected person's from the popup picker. But i am getting all the person's email address instead of that. Below is my code:
var query = new DTOs.Query<DTOs.RDO>();
query.ArtifactTypeGuid = GUIDCollection.O_PERSON_GUID;
query.Fields.Add(new DTOs.FieldValue(GUIDCollection.EMAIL_ADDRESS_GUID));
DTOs.QueryResultSet<DTOs.RDO> results = proxy.Repositories.RDO.Query(query);
if (!results.Success)
{
Utils.WriteToLog(": query for Tasks failed: " + results.Message);
throw new Exception(": query for Tasks failed: " + results.Message);
}
else
{
Utils.WriteToLog("InELSE_TaskPostSaveEH");
MultiChoiceFieldValueList multichoice = b[GUIDCollection.TAS_ASSIGNEE_GUID].ValsueAsMultipleChoice;
for(int i=0; i<multichoice.Count;i++)
{
DTOs.Choice multivalues=multichoice[i];
}
}
任何帮助都将不胜感激。
我尝试了什么:
我尝试以多种方式调整代码,但仍无法得到它。请帮帮我。
Any help would be appreciated.
What I have tried:
I tried tweaking the code in multiple ways but still unable to get it. Please help me with this.
答
foreach (var res in results.Results)
{
emailAddress += res.Artifact.Fields[0].Value.ToString() + ";";
}
您正在创建一个包含所有地址的字符串;为什么?您只需检查已选择的元素。
You are creating a string containing all the addresses; why? You need to check for only those elements that have been selected.