473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Datagrid.databind() causes "Object reference not set to an instance of an object" error



I have a datagrid with a collection of columns and the datagrid is
populated as in the code below. The value of test = 3 rows which is
correct. However I get an exception when the code hits the Databind line.
When I removed all the columns and dg is left with <columns></columns>, I
don't get an error. If there's any column in the collection no matter what
column it is, the error comes back. All the datafield names correspond to
the column names and the code worked before. What kind of troubleshooting
or debugging methods should I go about? The databind() seems to me like a
blackbox and it's doing stuff which I don't seem to be aware of.

TIA.
<asp:datagrid..... AutoGenerateColumns="False" DataKeyField="msid">
....
DataTable dtMembers = oMembers.SelectAll();
int test = dtMembers.Rows.Count;
dgMemberList.DataSource = dtMembers;
dgMemberList.DataBind();
--
John Dalberg
Nov 19 '05 #1
0 1363

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

Similar topics

0
by: howie | last post by:
I've upgraded a vb6 application to vb .net and am having an issue. whenever I try to set the recordset property of the VB6.adodc object in .net and run the application I get the error “object...
7
by: deko | last post by:
I'm getting intermittent "Object Invalid or No Longer Set" errors in my Access 2002 mdb. What causes these errors? Has anyone dealt with this before? I can't trace it because it's not easy...
6
by: Lauchlan M | last post by:
Hi. Usin ASP.NET, getting an "Object reference not set to an instance of an object" error. In my login.aspx page I have: string arrUserRoles = new string {"UserRole"};...
0
by: CDWaddell | last post by:
I have the following cod private void btnUpdate_Click(object sender, System.EventArgs e TextBox tbMembers = new TextBox() RadioButtonList rblRecruiting = new RadioButtonList() tbMembers =...
1
by: Kamal | last post by:
I am trying to send mail through smtp. smtp service is running on my machine. But every time during the smtpmail.send(msg) call gives "Could not access 'CDO.Message' object." error. Could some...
1
by: Lauchlan M | last post by:
Hi. I'm using ASP.NET, getting an "Object reference not set to an instance of an object" error. In my login.aspx page I have: string arrUserRoles = new string {"UserRole"};...
2
by: prince -=nore=- | last post by:
I have a page, where I'm retrieving a file location from a database and outputting it's contents (HTML) onto a web page. On the aspx page, I have referred to the code behind it using the line...
7
by: dhnriverside | last post by:
Hi peeps I'm just following this HOW-TO from MSDN.. http://support.microsoft.com/default.aspx?scid=kb;en-us;306355 But I've got a problem. I've adding the #using System.Diagnostics; line to...
2
by: louie.hutzel | last post by:
This JUST started happening, I don't remember changing any code: When I click the submit button on my form, stuff is supposed to happen (which it does correctly) and a result message is posted back...
0
by: piyumi80 | last post by:
hi, i wrote the following code to get a specific data row from the data set.but it generates the "Object reference not set to an instance of an object.".....error private void...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.