I have a forms collection (fc) and I'm attempting to append to an email the values of the 'key' and the 'value'. I'm having no problem with the key (newKey), but I can't seem to code the 'value' properly. The 'for' loop checks to see if the key's first 3 characters of the key are 'ddl' indicating it came from a dropdownlist. if so, the loop should append the value from the dropdownlist control (the value of the key-value pair). (If not, the loop calls another method to append either a yes or no based upon the value of a checkbox control) Thanks in advance.
//Append new key-value pairs implemented since legacy keys
for (int i = 0; i < newKeys.Length; i++ )
{
//Checks for prefix of element to determine type of element
if(newKeys[i].Substring(0,3) == "ddl"){
sb.Append(newKeys[i] + ": " + fc.GetValue(newKeys[i]) + "\",<br />");
sb.Append(newKeys[i] + ": " + fc.GetValues(newKeys[i].ToString()) + "\",<br />");
}
else{
sb.Append(newKeys[i] + ",\"" + Boolean(fc[newKeys[i]]) + "\",<br />");
}
}
The 2 sb.append commands return the following:
ddlStratacacheConstellationManagerRole: System.Web.Mvc.ValueProviderResult" ddlStratacacheConstellationManagerRole: System.String[]",