473,698 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox inside a Gridview gives a nullpointer exception

I have a gridview, and a listbox which has a different datasource. The
listbox contains distinct types of contacts, whereas the gridview will get
populated upon contact type selection.

The data is displayed but when on submission of the contact type from the
list box i get a null reference exception.

I already tried to trap using SelectedIndex -1 but that does not work..

Any pointers.

Thanks in advance
May 30 '07 #1
1 1356
On May 30, 10:34 pm, Smita <S...@discussio ns.microsoft.co mwrote:
I have a gridview, and a listbox which has a different datasource. The
listbox contains distinct types of contacts, whereas the gridview will get
populated upon contact type selection.

The data is displayed but when on submission of the contact type from the
list box i get a null reference exception.

I already tried to trap using SelectedIndex -1 but that does not work..

Any pointers.

Thanks in advance
Please send a piece of code where you get the exception.
Thanks!

May 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5902
by: Jason | last post by:
Here is an odd issue. I am trying to shed some light on why this is causing a problem. I have an ArrayList. I am binding it to a ListBox control with has its Sort property set to True. If the ArrayList only has one element in it everything works ok. But as soon as I have more than one element, I get the following exception when the control loads up: "Cannot modify the Items collection when the DataSource property is set.". Anybody...
1
3210
by: Josema | last post by:
Hi to all, I have a class (persons) that derives from collection base: and another class (person) with this properties: -ID -Name When i have complete filled the object Persons with all the persons, i put each persons inside a ListBox following this:
3
2205
by: nobs | last post by:
Hi guys I think I missunderstud something with delegates & events Hopefully someone can bring some light in this issue: Following problem I have a class which provide some events (like ServerQuitMsg) and in the code i call
4
2452
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item, what do I need to do in order to return the "option value" of the control? Moe !--- returned value of the control
7
1701
by: Zorpiedoman | last post by:
I'm confused. I have a listbox. The DataSource is a DataTable based on a SQL Select Statement that includes a where clause. For example, "Select ID, FirstName, LastName From Employees where DepartmentID = 5" I have three controls on the same form that are bound to this datatable. So far so good. I click through the list in the listbox, and the controls reflect the current selected item in the listbox. (Nice!)
0
1473
by: SimonZ | last post by:
If I have gridView and one of the columns is template cpolumn, where I have listBox in edit mode: <asp:TemplateField> <HeaderTemplate>CategorName:</HeaderTemplate> <ItemTemplate> <asp:Label runat="server" text='<%# Eval("CategoryName")%>'></asp:Label> </ItemTemplate> <EditItemTemplate>
4
4846
by: Marcos Beccar Varela | GamaCom Argentina | last post by:
Hello Everyone. I need to use a gridview, that when I use the Update command one of the colums, instead of showing a textbox where the user can write, I need a combobox (listobx), where there are 3 options. EG OF GRIDVIEW: USUER AGE carlosg old rominat young gonzalor normal florenciat young
2
12015
by: j.m.osterman | last post by:
I haven't found exactly what I've been trying to do. All I am trying to do for now is just display usernames from Active Directory into a ListBox control on a page. I have found some code however that will just capture a Full Name from Text Box and display information from the Active Directory into a DataTable. I will display that code below.
0
3097
by: =?Utf-8?B?Qm9i?= | last post by:
I have a GridView control in page called which is inheriting from a MasterPage. The normal code to export to GridView does not work and gives me an error - "Control of type GridView must be placed inside form tag with runat = server". I understand that this is because my Masterpage has the formtag and not the eventslisting page, but cannot figure a workaround. I have tried overriding VerifyRenderingInServerForm and everything else I can...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.