Mar 31, 2011, 1:09 PM
[CLOSED] ListItems / ComboBox - value is always a String?
Hello,
the ComboBox.Value is of type object, but when I get the value it is a string even though I do not put in a String then loading the Store.
If you look at ComboBox.SelectedItem.Value, "Value" is of type String and that comes from the fact the SelectedItem is of Type ListItem, and ListItems Value-property is String.
When I add data to my Store, that is by a ComboBox, I add an array of object[], like this:
Is it always gonna be String, and I have to parse that string (JSON??) somehow?
Regards
Ted
the ComboBox.Value is of type object, but when I get the value it is a string even though I do not put in a String then loading the Store.
If you look at ComboBox.SelectedItem.Value, "Value" is of type String and that comes from the fact the SelectedItem is of Type ListItem, and ListItems Value-property is String.
When I add data to my Store, that is by a ComboBox, I add an array of object[], like this:
List<object> myStoreObjects = new List<object>();
foreach (SomeObject cp2 in listOfObjects)
{
myStoreObjects.Add(new object[] { cp2.Id, cp2.ObjectName });
}
The Id property is an uint, and ObjectName a string. This is the Store:<ext:Store ID="Store_SomeObjects" runat="server" AutoDataBind="true" AutoLoad="true" >
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="SomeObjectId" />
<ext:RecordField Name="SomeObjectName" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
So I would like to get the uint back when I check what is selected in the ComboBox, but now I get a string. How do I get my real object? To convert string to uint is easy, but what if I have a complex custom object?Is it always gonna be String, and I have to parse that string (JSON??) somehow?
Regards
Ted
Last edited by Daniil; Apr 09, 2011 at 12:47 PM.
Reason: [CLOSED]