Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 03, 2011 03:09 PM by monoliths
Aug 03, 2011 12:46 PM|LINK
I am having an issues connection from a Gridiview. I ahve a Gridview that load on Page Load event with a column that contains some True/False values.
I have a check box that I hope to allow the user to click to hide all of the False by passing a value to the Stored Procedure that loads the page an including the value of false in a SP query.
Problem is that when I click the check box to fire the event, I am getting a connection string problem.
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.
System.NullReferenceException: Object reference not set to an instance of an
Line 65: End If
Line 67: itemDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionStringmyConn").ToString() Line 68:
Line 69: 'SqlDataSource1UpdateTest.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
[NullReferenceException: Object reference not set to an instance of an object.]
portal_bulkStringUpdate.CheckBox1_CheckedChanged(Object sender, EventArgs e) in C:\Users\mhornung\Documents\Visual Studio 2008\WebSites\WebSite2\portal\bulkStringUpdate.aspx.vb:71
System.Web.UI.WebControls.CheckBox.OnCheckedChanged(EventArgs e) +111
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485
Web config has string set up for all other pages and is working fine...
I bind to the Gridview later in the code.
itemDataSource.SelectCommand = SqlDataSourceCommandType.StoredProcedure
itemDataSource.SelectCommand = "usp_getForTableData" ' Call stored procedure
' Dim rowsAffected As Integer = 0
GridView1.DataSource = itemDataSource
Aug 03, 2011 12:58 PM|LINK
Seems Your not getting any Information in
in follwing line
Aug 03, 2011 01:04 PM|LINK
That would be true. Any ideas on the cause of the matter?
Aug 03, 2011 02:15 PM|LINK
check your Web.config file..
is connection string "ConnectionStringmyConn" define
Aug 03, 2011 02:31 PM|LINK
Yes and as I stated it is working on other web pages with no problem.
I have other pages that work with no problem.
Aug 03, 2011 02:40 PM|LINK
It looks like the connection string isn't getting instantiated on post-back. I have had similar issues in the past.
Aug 03, 2011 02:44 PM|LINK
How did you solve this?
Aug 03, 2011 03:09 PM|LINK
Set a break point in the check-changed method (I think, judging from your stack trace) and see what method you need to call to set the object value. The missing method is probably in the page or form load routine.