Here is the code for the button click event;
Protected Sub CompetenciesButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CompetenciesButton.Click
Dim con As String = WebConfigurationManager.ConnectionStrings("foo").ToString()
Dim selectedrow As String = Competencies.SelectedValue.ToString
Dim s As String = "SELECT * from foo WHERE (" & selectedrow & " =1)"
Dim DataAdapter As New SqlDataAdapter(s, con)
Dim Result As New DataTable
If Not IsNothing(DataAdapter) Then
DataAdapter.Fill(Result)
DataAdapter.Dispose()
End If
GV.DataSource = Result
GV.DataBind()
GV2.DataSource = Result
GV2.DataBind()
End Sub
Here is the stack:
[NullReferenceException: Object reference not set to an instance of an object.]
administration_Search.CompetenciesButton_Click(Object sender, EventArgs e) +28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Everything works fine offline in VS2008 but I get this error after publishing.
Thanks.