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.
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 reference not set to an instance of an
object.
Source Error:
Line 65: End If
Line 66:
Line 67: itemDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionStringmyConn").ToString() Line 68:
Line 69: 'SqlDataSource1UpdateTest.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
Stack Trace:
[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.WebControls.CheckBox.RaisePostDataChangedEvent() +134
System.Web.UI.WebControls.CheckBox.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +10
System.Web.UI.Page.RaiseChangedEvents() +165
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1485
Web config has string set up for all other pages and is working fine...
march11
Contributor
2981 Points
1350 Posts
Problem with Object Reference
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.
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 reference not set to an instance of an
object.
Source Error:
Line 65: End If Line 66: Line 67: itemDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionStringmyConn").ToString() Line 68: Line 69: 'SqlDataSource1UpdateTest.InsertCommandType = SqlDataSourceCommandType.StoredProcedureStack Trace:
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 itemDataSource.SelectParameters.Add("currTable", Session("currUserTable")).ToString() itemDataSource.SelectParameters.Add("needsTrans", sortTF) ' Dim rowsAffected As Integer = 0 GridView1.DataSource = itemDataSource GridView1.DataBind()