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
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