Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get a handle on a dropdowlist?

Reply
Thread Tools

Get a handle on a dropdowlist?

 
 
Chris Kettenbach
Guest
Posts: n/a
 
      10-17-2005
Good Morning All,
How can i get a handle on this drop down list?
public void myDropDown_OnDataBinding(object sender, EventArgs e)
{
DropDownList myDropDown = (DropDownList)sender;
Debug.Write(myDropDown.SelectedItem.Value);
}

gives me an Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.


Any ideas?

Thanks,
Chris






 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      10-17-2005
Apparently no item is selected, thus raising the NullRefernceException.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Chris Kettenbach" <> wrote in message
news:0oadnX_31aH6T87eRVn-...
> Good Morning All,
> How can i get a handle on this drop down list?
> public void myDropDown_OnDataBinding(object sender, EventArgs e)
> {
> DropDownList myDropDown = (DropDownList)sender;
> Debug.Write(myDropDown.SelectedItem.Value);
> }
>
> gives me an Exception Details: System.NullReferenceException: Object
> reference not set to an instance of an object.
>
>
> Any ideas?
>
> Thanks,
> Chris
>
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Siva M
Guest
Posts: n/a
 
      10-17-2005
Likely myDropDown.SelectedItem is null?

"Chris Kettenbach" <> wrote in message
news:0oadnX_31aH6T87eRVn-...
Good Morning All,
How can i get a handle on this drop down list?
public void myDropDown_OnDataBinding(object sender, EventArgs e)
{
DropDownList myDropDown = (DropDownList)sender;
Debug.Write(myDropDown.SelectedItem.Value);
}

gives me an Exception Details: System.NullReferenceException: Object
reference not set to an instance of an object.


Any ideas?

Thanks,
Chris







 
Reply With Quote
 
=?Utf-8?B?U3JlZWppdGggUmFt?=
Guest
Posts: n/a
 
      10-17-2005
it could be that the SelectedItem object is what raising the null exception..
DropDownList myDropDown = (DropDownList)sender; should be working..

by the way,

"Chris Kettenbach" wrote:

> Good Morning All,
> How can i get a handle on this drop down list?
> public void myDropDown_OnDataBinding(object sender, EventArgs e)
> {
> DropDownList myDropDown = (DropDownList)sender;
> Debug.Write(myDropDown.SelectedItem.Value);
> }
>
> gives me an Exception Details: System.NullReferenceException: Object
> reference not set to an instance of an object.
>
>
> Any ideas?
>
> Thanks,
> Chris
>
>
>
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get ubuntu ! Get ubuntu ! Get ubuntu ! Get ubuntu ! Getubuntu Windows 64bit 1 06-01-2009 08:54 AM
Package to handle table text render (handle space or tab betweenthe columns) ? =?ISO-8859-1?Q?KLEIN_St=E9phane?= Python 3 10-06-2006 08:46 AM
Possible to handle web requests without an ASPX page? i.e. have DLL handle request. jdlwright@shaw.ca ASP .Net 2 05-31-2005 05:42 PM
how to handle command line output(not terminal handle) Leon Python 2 11-04-2004 05:16 AM
File Handle Reading Blues: Rereading a File Handle for Input Dietrich Perl 1 07-22-2004 10:02 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57