DropList SelectedItem

T

Tim

Yesterday this worked.

Today, on my web forms when they are posted I am getting errors with the
SelectedItem properties on droplists.

Specifically, the following:

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.


Line 68: acIDFrom = cboAccount.SelectedItem.Value

[NullReferenceException: Object reference not set to an instance of an
object.]
Trial1.Transfers.cmdTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\Trial1\test.aspx.vb:68
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

The variable cboAccount is set correctly - I can browse its properties in
the Locals list while on a breakpoint. The SelectedItem property is clearly
visible as nothing.

Things are odder and odder. This worked up until today. I have tried setting
the selectindex in code, selecting the droplist values to various values and
so on. If I set the selectedindex to 1 it works, but only ever for the value
pair with that index even if the web client selects a different value.

Does anyone have any ideas?

TIA
- Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top