TreeView Adapter SelectedValue problem

Jun 27, 2007 at 9:16 PM
I am having a problem using the SelectedValue proprty outside of the onClick event. I have added the following code to SimpleTreeView.aspx in the walk through example code. When using the adapter, EntertainmentTreeView.SelectedValue is always null. When not using the adapter, EntertainmentTreeView.SelectedValue contains the expected value for the item I clicked.

Why can I not access EntertainmentTreeView.SelectedValue outside of the OnClick method?

Here's the code I added (just putting the onclick guts into Page_Load):

protected void Page_Load(object sender, EventArgs e)
{
MessageLabel.Text = "You selected " + EntertainmentTreeView.SelectedValue + ".";
}
Jul 31, 2007 at 5:14 AM
Has anyone helped you out on this? I'm in the same situation and even (unsuccessfully) stepped through the adapter code trying to figure out why I can't access the SelectedNode anywhere else than the default (from the example in the CSS Friendly Adapters sample) inline script's "OnClick" method.