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

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

P: n/a


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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.