How do I set a fields value on the same row from code in a button? - InfoPath Dev
in

InfoPath Dev

How do I set a fields value on the same row from code in a button?

Last post 01-13-2010 12:40 PM by lukeksmith. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-05-2010 07:27 AM

    How do I set a fields value on the same row from code in a button?

    I have a text box and a button in a repeating table.  When I press the button an openfiledialog appears.  When the file is selected, I would like the text box to be updated with the filename.  I can get this to work for one row, but when I add a second row to the mix, the button still only updates the first row.

     How can I have the button update the field of the same row?

     Here is the code:

     

    public void CTRL49_7_OnClick(DocActionEvent e)

    {

     

    FileDialog oDialog = new OpenFileDialog();if (oDialog.ShowDialog() == DialogResult.OK)

    {

    string sFilename = oDialog.FileName;

    thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:A_PlaylistData/@APD_FilenameAndPath").text = sFilename;

    }

    }

  • 01-07-2010 04:02 PM In reply to

    Re: How do I set a fields value on the same row from code in a button?

    e.Source will get you the current node -- the one the button is in. So, you can modify:

    thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:A_PlaylistData/@APD_FilenameAndPath").text = sFilename;

    to:

    e.Source.selectSingleNode("@APD_FilenameAndPath").text = sFilename;

    If, for example, A_PlaylistData is your repeating group.

    Hilary Stoupa

  • 01-13-2010 12:40 PM In reply to

    Re: How do I set a fields value on the same row from code in a button?

     It worked!  Thanks!

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.