I have created a gridview which will edit an XML file (the XML file is quite complicated).
The data binds fine to gridview, code is following for doing this.
HOWEVER when clicking "Edit" I get the error
"System.NullReferenceException: Object reference not set to an instance of an object."
'code to bind to gridview Public Sub FillGridview(ByVal XPath As String, ByVal GridView As GridView)
Dim xml As New XmlDataSource
xml.DataFile ="my file.xml"
xml.XPath = XPath
GridView.DataSource = xml
'code to edit gridview row
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
GridView1.EditIndex = e.NewEditIndex
...do some stuff here to get the XPath
'rebind to data - does same as whatever button user clicked on
the error happens at line GridView.DataBind() of FillGridview
thanks in advance for help!