About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Wednesday, 19 November 2014

Delete/Remove single row from InfoPath Repeating Table

Here is simple code snippet to get current row context in InfoPath repeating table
There are two ways
1. Assuming that, the delete or any other button is also part of the same row
     Place below code in button click event in the code (Visual Studio). This is straight forward in case
     of deleting current row in the repeating table
   public void DeleteRow_Clicked(object sender, ClickedEventArgs e)
   {

      // Write your code here.

      e.Source.DeleteSelf();
   }

2. Assuming that the button is out side of the repeating table. This is also very much easy
     public void Button1_Clicked(object sender, ClickedEventArgs e)
   {
      XPathNavigator nav = e.Source.CreateNavigator();
      string ProjectId = nav.SelectSingleNode("my:ProjectID",  
                         NamespaceManager).Value;
      string ProjectTitle = nav.SelectSingleNode("my:ProjectTitle",
                             NamespaceManager).Value;
   }    
    
     Note: Replace ProjectID & ProjectTitle with your respective fields.


Cheers!
Vamsi

No comments:

Post a Comment