In Infopath form , I am writing c# code for list item changed event , My requirement is I need to get the ID of the list item which is modified. I tried it by using
int id = Int32.Parse(e.Site.SelectSingleNode("../@d:ID", NamespaceManager).Value);
I am getting error as - "object reference not set to an instance of an object"
Code is -
public void TestEmp__Title_Changed(object sender, XmlEventArgs e)
{
// Write your code here to change the main data source.
if (e.Operation == XmlOperation.ValueChange)
{
if (e.Site.Name == "d:Title" && e.OldValue != e.NewValue)
{
// Get the ID of the item to be changed
int id = Int32.Parse(e.Site.SelectSingleNode("../ID", NamespaceManager).Value);
}
}
When it reaches above step, error gets generated.
Can you tell me what change need to be done. Thanks in advance .
Regards
Indresh
Indresh