I have a Json something like below: [{"Example temp" : "value"}, {"Example Default" : "", "selected": true}]
I need to fill a dropdown say for example: Dropdown should contain values : Example temp Example Default
And Example Default should be the default selected value,
I tried below code:
JArray jArray = JArray.Parse(jsonstring);
foreach (JObject jObject in jArray.Children<JObject>())
{
foreach (JProperty jProperty in jObject.Properties())
{
string name = jProperty.Name.Trim();
string value = jProperty.Value.ToString().Trim();
drpValues.Items.Add(new RadComboBoxItem(name, value));
}
}
But "selected" also comes as a dropdown value.
Any help is greatly appreciated.
Thank you so much!
-PT
[{"Text" : "Example temp", "Value" : "SomeValue"}, {"Text" : "Example Default", "Value" : "", "selected": true}]