Hi Travis,
I'm not sure I understand your problem. Are you just trying to
maintain the selection after you databind again? You can do this by
grabbing the value *before* you bind the second time... OR you can use
EasyListBox and save yourself a whole lot of contortions.
Cheers,
Peter
-----Original Message-----
From: Falls, Travis D (HTSC, CASD) [mailto:[EMAIL PROTECTED]
Raft_IDList is a drop down control. I am selecting something and
rebuilding a bunch by re quering the database and binding. I want to
set the selected item in the drop down that I just selected but with the
rebind I don't. I tried this after I bind where items is the hashtable
of the items selected and jobid is the key.
Hashtable items = getMenuItems(sender, e); //items selected
dao.buildLogandDropDownView(items); // data access object
raft_IDList.DataSource = dao.getRaftIDView(); // gets the data view for
each drop down
raft_IDList.DataTextField = "RaftID";
raft_IDList.DataValueField = "RaftID";
raft_IDList.DataBind();
raft_IDList.Items.Insert(0, new ListItem("",""));
raft_IDList.Items.FindByValue(((String)items["jobid"])).Selected=true;
I get the following error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Any ideas how I can set the selected item in a dropdown based on a
value?
Travis D. Falls |Consultant, Raft.Net IT | 860.547.4070 |
[EMAIL PROTECTED]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/