C# Select a row in a reapeating table - InfoPath Dev
in

InfoPath Dev

C# Select a row in a reapeating table

Last post 07-13-2005 02:22 AM by Agni Jonnalagadda. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 06-23-2005 12:04 AM

    C# Select a row in a reapeating table

    Hi,

    What i need to do is:

    I have a reapeating table with a lot of row

    I wan't to click on the row that I want (so now the row is highlighted)!

    Is it possible to now which row is?

    How can I on a button click event catch the correct (current)row(in c#)?

    And use it for populate my primary database!

    Can you give me an example or only the syntax?


    Thanks in Advance

    ++

    Thierry


    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 06-23-2005 06:03 AM In reply to

    Re: C# Select a row in a reapeating table

  • 06-23-2005 06:26 AM In reply to

    Re: C# Select a row in a reapeating table

    Hi,
    If the button is in the row, "e.Source" will get you the selected row.

    If the button is at the bottom you can use

    //xPath should poin to the Repeating node
    IXMLDOMNode oNodes = getNode("/RootNode/RepeatingNode");]

    //"CTRL22":- you will get this when you see the view.xsl file for that particular repeating table
    int iMemberId = Convert.ToInt32(thisXDocument.GetNamedNodeProperty(oNodes, "CTRL22", "-1"));

    This above line will get you the selected the rowID. With that row id you can get the node.



    Agni
    InfoPathDev India
  • 06-23-2005 12:14 PM In reply to

    Re: C# Select a row in a reapeating table

    As Agni said, if you are clicking a button on the row, you can look at e.Source.

    Since you have a master table (i.e. row highlighting), you can also find out the row from that... take a look here:http://www.infopathdev.com/downloads/free/default.aspx?i=c56d9528ec4f4317a5bd469ac4e90b9d

    Greg Collins [InfoPath MVP]
    InfoPath Dev
  • 06-23-2005 11:52 PM In reply to

    Re: C# Select a row in a reapeating table

    Hi all,

    Thanks a lot for your answer I think That I want to use :

    >>>If the button is in the row, "e.Source" will get you the selected row.

    It's work great !

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 06-24-2005 01:35 AM In reply to

    Re: C# Select a row in a reapeating table

    Ok I have some probleme I can have the node (the xml is well formed) that I wan't but I'm unable to navigate for search the node that I need. My Code:

    IXMLDOMNode res= e.Source;

    IXMLDOMNode NewFirma= res.selectSingleNode("/Extract/Firma/Search/Found/Hauptfassung");
    IXMLDOMNode NewSitz = res.selectSingleNode("/Extract/Firma/Search/Found/Sitz");
    IXMLDOMNode NewRF= res.selectSingleNode("/Extract/@RF");
    IXMLDOMNode NewCHNR= res.selectSingleNode("/Extract/@CHNR");

    And that found nothing anybody has an idea?

    Thanks a lot for your help!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 06-24-2005 01:37 AM In reply to

    Re: C# Select a row in a reapeating table

    I forget my xml:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Extract Amt="150" CHNR="CH-150.1.000.165-0" Kanton="NW" RF="1" Stempel="2005-06-18T13:07:05" Visum="Exp" inBearb="0" lang="1" lastTB="1998-04-24" suffix="_" valid="1" validOnly="0">
    <Firma>
    <Bez Ein="1" SitzNr="1506" fldID="101" fldType="Hauptfassung" loe="2" mut="0" seq="0" toCheck="0" valid="0">Allweg-Garage, Paul Michel</Bez>
    <Bez Ein="2" SitzNr="1509" fldID="101" fldType="Hauptfassung" loe="0" mut="0" seq="0" toCheck="0" valid="1">Auto Michel</Bez>
    <Search>
    <Found Amt="150" CHNR="CH-150.1.000.165-0" Ein="2" Kanton="NW" RF="1" valid="1">
    <Hauptfassung>Auto Michel</Hauptfassung>
    <Sitz SitzNr="1509">Stans</Sitz>
    <Link><![CDATAhttp://zefix.powernet.ch/webservices/HRG/HRG.asmx/getHRGHTML?chnr=1501000165&amt=150&toBeModified=0&validOnly=%%%%%&lang=^&sort=0]]></Link>
    </Found>
    </Search>
    </Firma>
    </Extract>
    ++

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 06-24-2005 03:44 AM In reply to

    Re: C# Select a row in a reapeating table

    I guess your e.Source is "Extract" node.
    If my guess is correct you are already in "Extract" node so you need not have it in the XPath again.
    So, your code should be
    IXMLDOMNode NewFirma= res.selectSingleNode("/Firma/Search/Found/Hauptfassung");
    IXMLDOMNode NewSitz = res.selectSingleNode("/Firma/Search/Found/Sitz");
    IXMLDOMNode NewRF= res.selectSingleNode("/@RF");
    IXMLDOMNode NewCHNR= res.selectSingleNode("/@CHNR");


    Agni
    InfoPathDev India
  • 06-29-2005 05:31 AM In reply to

    Re: C# Select a row in a reapeating table

    Hi,

    Thanks for your answer!

    I would try but now my server is crash (for one day)! So I can try I have to repair him before!

    ++

    Thierry



    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 07-11-2005 02:04 AM In reply to

    Re: C# Select a row in a reapeating table

    Hi,

    Thanks a lot!

    That's work great for this but I have another button that on click have to replace all the data entered in primary datasource by e.source how to proceed?

    Only the prefix of namespace (ns2: instead of ns1:)change.
    Do I have to make a xslt transform (with a custom XSLT) for replace ns2 by ns1 and after I make a replacechild or there are an easy way to accomplish that?

    Thanks

    ++

    Thierry



    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 07-11-2005 10:17 PM In reply to

    Re: C# Select a row in a reapeating table

    If you are good at xsl transform then that would be good solution for you.

    But does all nodes(child nodes also) have ns1 as prefix? If only root nodes have ns1 as prefix, you can pick up the child nodes as is and apppend them.

    Agni
    InfoPathDev India
  • 07-13-2005 12:51 AM In reply to

    Re: C# Select a row in a reapeating table

    ok thanks for your answer! That work fine!

    ++

    Thierry

    Every moment hesitated is a moment gone for life!!! Think about it
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 07-13-2005 02:22 AM In reply to

    Re: C# Select a row in a reapeating table

    Which solution did you use XSL transform or Childnodes?

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