January 31, 2013 at 10:39 am
I have a multi-value parameter that I am setting the default to using my own custom assembly. The function in the assembly returns a string, and this works fine if I default it to 1 value, ie Option1. But if I try to set it to 2 nothing is selected. So my question is what format do I need to return from my function in order to select more than 1 default value? This is what I have tried so far:
Return a string: "Option1, Option2"
Return a string: "Option1,Option2"
Return a string: "'Option1', 'Option2'"
Return a List<string>
Return a DataTable
Return a DataSet
Thanks
February 1, 2013 at 8:23 am
I figured it out. I had to return an array of strings....like this
public static List<string> GetParameterValues(string sList, string sParameterName)
{
string parameterValue = "";
List<string> returnList = new List<string>();
XmlDocument doc = new XmlDocument();
doc.LoadXml(sList);
XmlNodeList xnList = doc.SelectNodes("/Parameters/Parameter");
foreach (XmlNode xn in xnList)
{
if (xn["ParameterName"].InnerText == sParameterName)
{
parameterValue = xn["ParameterValue"].InnerXml.ToString();
string[] parameters = parameterValue.Split(',');
foreach (string parameter in parameters)
{
returnList.Add(parameter);
}
break;
}
}
return returnList;
}
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply