S
Sosh
Hi,
Maybe someone could shed some light on the following situation. I
have a ListBox wich I have bound with some names and ids. I then get
do another query to bind some info to page,and also pre-select the
appropiate item on the ListBox.
I am using an dataset for the second query the second query.
I start by doing something like this:
theListBox.SelectedValue = ds.Tables[0].Rows[0]["ID"] as String;
However, nothing gets seleted, even though the values match. In fact
the MS documentation says it throws an exception if you try to set it
to something that does not exists. So I test that:
theListBox.SelectedValue = "123456";
Sure enough I get the exception. Then I try:
theListBox.SelectedValue = ds.Tables[0].Rows[0]["ID"].ToString();
And it works. Can anyone tell my why using the first method it
neither works properly nor throws an exception?
Thanks.
Maybe someone could shed some light on the following situation. I
have a ListBox wich I have bound with some names and ids. I then get
do another query to bind some info to page,and also pre-select the
appropiate item on the ListBox.
I am using an dataset for the second query the second query.
I start by doing something like this:
theListBox.SelectedValue = ds.Tables[0].Rows[0]["ID"] as String;
However, nothing gets seleted, even though the values match. In fact
the MS documentation says it throws an exception if you try to set it
to something that does not exists. So I test that:
theListBox.SelectedValue = "123456";
Sure enough I get the exception. Then I try:
theListBox.SelectedValue = ds.Tables[0].Rows[0]["ID"].ToString();
And it works. Can anyone tell my why using the first method it
neither works properly nor throws an exception?
Thanks.