Error in Data Binding Of Repeater Object of a WebUserControl: "Object reference not set to an instance of an object."

Hi all dudes,
I have written the following Code below for Bind a Repeater object in a WebUserControl Object.
When I want to set the the DataSource property of Repeater, It encounters the following error:

"Object reference not set to an instance of an object."

Line 37:     Reader = Cmd.ExecuteReader()
Line 38:     Me.Rpt.DataSource = Reader
Line 39:     Me.Rpt.DataBind()

When I paste this code in a New WebForm, it doesn't have any problems.
So can anyone help me plz ?
Thanks in Advance.





Public
Sub BindRepeater2(ByVal GroupID As String)

Dim StrSQL As String = "SELECT * FROM " + tblSites + " WHERE GroupID=" + GroupID

Conn = New OleDbConnection(ConnStr)

Conn.Open()

Dim Cmd As New OleDbCommand(StrSQL, Conn)

Dim Reader As OleDbDataReader

Reader = Cmd.ExecuteReader()

Me.Rpt.DataSource = Reader

Me.Rpt.DataBind()

Reader.Close()

Conn.Close()

Conn.Dispose()

End Sub

0
sma_soft
8/30/2005 7:48:51 PM
asp.net.object-datasource 16182 articles. 0 followers. Follow

2 Replies
1430 Views

Similar Articles

[PageSpeed] 52

Check to see if Me.Rpt is Nothing.  I would guess that it is, and that is your problem.
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
0
douglas
8/30/2005 8:24:34 PM
I'm sure that Me.Rpt is not Nothing. Because I put a Repeater Object in my WebUserControl. 
I think Repeater Object has problems with WebUserControls.
0
sma_soft
8/31/2005 9:07:50 AM
Reply:

Similar Artilces:

Data Source Error Message: "Object reference not set to an instance of an object"
I have been developing a web site using Visual Web Developer (VWD) for several months.  As quirky as VWD is, it is great for a newbie ASP.NET developer like me.    So here is the problem.   For no apparent reason, I can no longer create or modify data sources using the “Query Builder” or the “Design Custom Statements or Stored Procedures” tool.  I am able to “Choose a database” but then the next step (“Configure the select statement”) fails showing the error messages below.      ERROR MESSAGES:   (1) When I try to use the "Query Bui...

Getting an "Object reference not set to an instance of an object", and no idea which object
I'm working on one of our ASP.NET 2005 projects now.  For the longest time we've gotten an error when compiling it that says, "Object reference not set to an instance of an object".  However, the irritating thing is it doesn't say what "object" its having problems with, and it certainly isn't telling me which file that has the problem.  So, I'm getting this error message that doesn't tell me where the error comes from.  All I know is that the error is "Out there".  Reminds me of an old X-Files episode. How am I t...

"Object reference not set to an instance of an object. " error
Hi all, I wote the coding as below, and when I run it, it gave me "Object reference not set to an instance of an object. " error. Anyone know how tosolve it? Thanks a lot. ' connect to the DBDim conn As SqlConnection = New SqlConnection conn .ConnectionString = Cred.ConDB 'execute the stored proc StrExeSQL is the stringDim StrExeSQL As String = Cred.EXEgetCompName 'sqlcmd executes the string on the connection givenDim sqlCmd As SqlCommand sqlCmd = New SqlCommand(StrExeSQL, conn) ' add the parameters required by the sproc and stringWith sqlCmd .Parame...

Error "Object reference not set to an instance of an object"
Dear Experts, I have been trying to accomplish a simple task in as.net. However, when I try to render the application I get the following error: "Object reference not set to an instance of an object". I have two computers in my house. The application is working fine in one computer but on the other the error occur. Hope you could help me, Tzachi Slav application code: <--------------------------------------------------------------------------------------- Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs...

"Object reference not set to an instance of an object" error
I know users say this all the time - "I didn't change anything". In this case, it's true. I haven't modified DesktopDefault.aspx but it suddenly started crashing with a "Object reference not set to an instance of an object" error. The error is on the "<form runat="server">" line in the html. Many months ago, I put in some javascript to insure that the window was maximized at startup; I took that out with the same error result. What would cause the portal to crash on <form runat="server"> statement? here's the trace statements returned by the server: <trace> Line 55: Line 56: </script> Line 57: <form runat="server"> Line 58: <table width="100%" cellspacing="0" cellpadding="0" border="0"> Line 59: <tr valign="top"> Source File: C:\saveeachchild\DesktopDefault.aspx Line: 57 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] System.Web.UI.Control.get_Controls() System.Web.UI.Control.AddParsedSubObject(Object obj) System.Web.UI.Control.System.Web.UI.IParserAccessor.AddParsedSubObject(Object obj) ASP.DesktopDefault_aspx.__BuildControl__control2() in C:\saveeachchild\DesktopDefault.aspx:57 ASP.DesktopDefault_aspx.__BuildControlTree(Control __ctrl) in C:\saveeachchild\DesktopDefault.aspx:1 ASP....

Error "object reference not set to an instance of an object"
hi,I develop a usercontrol in my windows application. I got a error. I can’t rectify the error. Please help me I have two .cs files one is  user.cs another is Form1.cs.User.cs is usercontrol.Form1.cs is application  The error is “object reference not set to an instance of an object” This program working well in .NET 1.1Currentlly I am changed into .NET 2.0   What is differ from .NET 1.1 to .NET 2.0?   // Code of User.cs using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using Syste...

ERROR "Object Reference is not set to an instance of an Object"
hi guys,           i m working on a project. and getting an error "Object reference is not set to an instance of an object" while fetching the data from server.           what is meannning of this error. and how to solve it.           plz help. thanks and Regards rakesh                  code required to trace the error.Plz paste the code.Thank uBabaPlease remember ...

Error "Object reference not set to an instance of an object"
Hi all, I have a problem consuming a web service. I create the THTTPRIO object of my service and then I try to call a method, but in this call I always catch the exception "Object reference not set to an instance of an object", for every method of the service. I use BDS2006 but I download an upgrade for wsdlImporter to correctly import WSDL that use schemaLocation with references to external XSD files. In this way I can correctly create the unit of the service. I try to test the web service with soapUI (and also with webservices studio) and with these applications methods neve...

"Object reference not set to an instance of an object" error
everytime i create a new user, i get the following error and unable to see the frontpage of the time tracker. However, when i look up the database, the new user's id is already created. can anyone help? ============================================================ Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object ref...

Error: "Object reference not set to an instance of an object."
I had this working at one point, but now I'm getting an error, "Object reference not set to an instance of an object" and it's point to line #42. Line 40:         Dim sqldatasource1 As New SqlDataSourceLine 41:         dv = DirectCast(sqldatasource1.Select(DataSourceSelectArguments.Empty), DataView)Line 42:         EID = DirectCast(dv.Table.Rows(0)(0), String)Line 43:         txtEmail.Text = EID.ToString()Line 44: ...

Error "Object Reference not set to an instance of an Object"
Hi Guys I am having problem with my code. I dont know where I am doing mistake. It works perfectly on my system. But If I launch it on our development server I am getting error "Object Reference not set to an instance of an Object".(Line where I am getting this error is underlined). I tried in many different ways. But couldnt find a solution to this. Any help will be highly appreciated. here is my code , developed using asp.net1.1 + C#. Here AdFeatImage is a usercontrol which is used 10 times in this web page. @@@@@@@@@@@@@@@@@@@@@@@@  // AdFeatImage uc=new AdFeatImag...

"Object reference not set to an instance of an object" Error
Hi,I got this error on Sharepoint Server 2007. I can'y deploy my web part anyway. Firstly i was able to deploy but after that i started to get this error although i did not change anything? "Error 1 Object reference not set to an instance of an object. 0 0 "How can i solve this?  Regards..  You're not alone on this... looking for an answer too!  When do you actually get this error? Can you post a screen shot of it? ...oh, and do you have any custom workflows?   Steve I have the same problem too When do you actually get this error?when I have to ...

ERROR: "Object reference not set to an instance of an object." ?
I am receiving the error "Object reference not set to an instance of an object." from the following line of code: my code:-----------------------------------------------If Not IsPostBack Then            conHRISDb.Open()            Dim dvJobInfo As DataView            Dim strSql As New SqlCommand            Dim dtrDataGrid As SqlDataReader      &...

Using "New" for "Object reference not set to an instance of an object" error doesn't work...
Hi, I'm trying to build a sql insert statement by reading through each textbox the footer of a DataGrid control. Here's my datagrid code:<asp:DataGrid ID="Datagrid1" runat="server" OnPageIndexChanged="dgPersonnelType_PageChanger" AutoGenerateColumns="False" CellPadding="4" AlternatingItemStyle-BackColor="#FFFFBB" AllowPaging="True" PageSize="20" ShowFooter="True"> <ItemStyle BackColor="WhiteSmoke" Font-Names="verdana" Font-Size="10px" /> <Columns> <asp:TemplateColumn HeaderText="Insert"> <HeaderStyle BackColor="#CCCC99" Font-Bold="true" Font-Names="verdana" Font-Size="12px" /> <FooterTemplate> <asp:LinkButton ID="lbtnInsert" runat="server" CommandName="Insert">Insert</asp:LinkButton> </FooterTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Default Pay Rate"> <HeaderStyle BackColor="#CCCC99" Font-Bold="true" Font-Names="verdana" Font-Size="12px" /> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DefaultPayRate", "{0:c}") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DefaultPayRate", "{0:c}") %>'></asp:TextBox> </EditItemTemplate> <FooterTemplate> <asp:TextBox ID="tx...

Error: "Object reference not set to an instance of an object" at the Server
Hi guys,   I had never worked with Crystal Reports before, this is my first big web project with ASP.NET/VB.NET and I’m using crystal reports to create the reports, they are working fine at the workstation, but at the server I’m getting an “Object reference not set to an instance of an object.” error.   The project was copied over to the server, no installation; virtual directory path is a directory somewhere in the server. I tried copying  Crystal dll’s to the application \bin directory but I'm still getting the same error.   I really need help with this issue, the...

Error while publishing : "object reference not set to an instance of object"
Hi All, I am getting "Object reference not set to an instance of object" error while trying to publish my asp.net 2.0 application. I am able to build the application successfully without any error. And this error doesn't give any detail. Only the error message is coming. As the application includes around 40 projects I am unable to find what is the cause for this. Somebody else who have faced similar situation please help. As it is building will that be some IIS problem? I am now deploying it locally only. ie, Same system in which I have built the application. Any help is appreciated. Re...

AccessDataSource Error: "Object reference not set to an instance of an object."
I can place an Access database in App_Data. I can place an AccessDataSource control on a page and click the Configure Data Source hyperlink. I can then choose a database and click Next. But the screen that follows (Define Custom Statements or Stored Procedures) is causing problems. Unlike other installations of VWD I have seen, I am not presented with a list of database columns from which I can select to build my SQL query. If I click the Query Builder button on this page, I get the following error message: "Object reference not set to an instance of an object." Help!  ...

error message" Object reference not set to an instance of an object"
when I created a object of user control in host page. then calling user control function. I get this error message "Object reference not set to an instance of an object". I don't know what's going on.  Thanks for your help! public my_host_page class private sub page_load()     dim user_control_obj  AS New User_control        user_control_obj.myfunction() end sub End Class Is user_control from different class or belong to tihs classFadil Alnassar www.fadilalnassar.com | FREE Nodil Tab Controlhttp://www.mefranchising.com How...

Automation error::"Object reference not set to an instance of an object."
I'm doing a server side automation(I know it's bad but..) and its working fine locally and when accessing it from a remote machine using web browser is was giving me this error"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005". so I configured the server using dcomcnfg as described in this link: http://support.microsoft.com/kb/288368/  and know this error now is gone but I'm having this error:"Object reference not set to an instance of an object." when it comes to the last line of this code...

DataGrid and error "Object reference not set to an instance of an object"
Here is my code  myDataGrid.DataSource=... myDataGrid.DataBind() I expected it will post data, but got error msg "Object reference not set to an instance of an object", do I need to do some set in DataGrid ? ///// I did see this code worked in another one page //// I would have to see more of the code before I could help.  In particular, the stuff that leads up to myDataGrid.DataSource = ...Whether you think you can or you think you can't; you're right.If Heaven ain't a lot like Detroit, then I don't wanna go... - Uncle Cracker i can see two posible reasons ...

"Object reference not set to an instance of an object" error #2
everytime i create a new user, i get the following error and unable to see the frontpage of existing users. However, when i look up the database, the new user's id is already created. can anyone help? ============================================================ Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object ref...

Server error: "Object reference not set to an instance of an object."
Hello. I'm creating an AJAX Accordion control that pulls in a list of colleges and programs from a university database and creates the accordion panes at runtime. That is all well and good. The problem I'm having is the first row of the data table isn't coming in. The code is below. I suspect the bolded lines are causing the problem. Basically, the first time through the loop, rowCount = 1 and since that rowCount > 1 condition isn't met, the loop isn't executing. Additional times through the loop work correctly. If I change the loop condition to be rowCount >= 1 (or...

Error on WDP build "ASPNETCOMPILER : error ASPRUNTIME: Object reference not set to an instance of an object."
I'm having a problem with a web deployment project, the website builds fine (few warnings, nothing serious) but when I try to build the associated web deployment project it fails with a totally unhelpful 'Object reference not set to an instance of an object.' error in the ASPNETCOMPILER file??!The output from the build is:Target "AspNetCompiler" in file "C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets":  Using "AspNetCompiler" task from assembly "Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".  Task "A...

"Object Reference Not Set to an instance of an object" error I get when I am trying to find an instance in a string
Hi, I am using the IndexOf function of the string class to find a specific instance of a string. And based on that I have a logic to do something. Below is the example of what I am doing. The code is in production and is working fine. But for some instance I am getting an "Object reference not set error". Yeah its intermittent. The requestXML is a string of xml data passed in as a paramter to a subroutine. I am fetching the xml string as a form post in a request object.  The only thing I could think of getting this kind of error is when the requestXML string variareque...

Web resources about - Error in Data Binding Of Repeater Object of a WebUserControl: "Object reference not set to an instance of an object." - asp.net.object-datasource

Resources last updated: 3/20/2016 5:28:36 PM