By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,588 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,588 IT Pros & Developers. It's quick & easy.

ListBox.SelectedItem.Text is not set to an instance of object

P: n/a
Jax
I do this kind of thing all the time in applications but with ASP.NET i have
problems with selecting an item in a list box and reading that selected text
out when something like a button is pressed.
First the problem was to do with the listbox losing it's selected item, now
i've managed to keep it but whenever i want to perform some kind of
opewration i get "Reference is not set to an instance of object".
Can anyone help at all?

jax
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I find it generally means you've made a typo on the aspx page. The id of
the control must match the name of the control on the page behind.

e.g.
protected System.Web.UI.WebControls.Label lblName;

<asp:Label id="lblName" runat="server"></asp:label>

Or perhaps you've forgotten the runat="server".

Matt

"Jax" <i_am_anti_(spamless)ev********@hotmail.com> wrote in message
news:bp**********@titan.btinternet.com...
I do this kind of thing all the time in applications but with ASP.NET i have problems with selecting an item in a list box and reading that selected text out when something like a button is pressed.
First the problem was to do with the listbox losing it's selected item, now i've managed to keep it but whenever i want to perform some kind of
opewration i get "Reference is not set to an instance of object".
Can anyone help at all?

jax

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.