Apr 01, 2015, 5:41 PM
ComboBox and SelectedItem
Hi
I have some 1.7 code that don't run good in 2.5
I have a ComoBox that I set SelectedItem in PageLoad like this:
then I run a function
Now id contains "1" instead of just 1, with the extra "".
This only occur if I call method() from DocumentReady.
Not if I call metod from a button that I click on, then id contains just 1 as it did in the version 1.7
Why is that? And how do I get rid of the extra ""
Best regards
Mikael
I have some 1.7 code that don't run good in 2.5
I have a ComoBox that I set SelectedItem in PageLoad like this:
if (!X.IsAjaxRequest)
{
listItem.ID = 2;
listIte.Name = "Hello";
cb.SelectedItems.Add(listItem);
cb.UpdateSelectedItems();
}
then I run a function
<Listeners><DocumentReady Handler="App.direct.method();" /></Listeners>
[DirectMethod]
public void method()
{
string id = cb.SelectedItem;
}
Now id contains "1" instead of just 1, with the extra "".
This only occur if I call method() from DocumentReady.
Not if I call metod from a button that I click on, then id contains just 1 as it did in the version 1.7
Why is that? And how do I get rid of the extra ""
Best regards
Mikael