get value from dropdown list with c# - InfoPath Dev
in

InfoPath Dev

get value from dropdown list with c#

Last post 08-22-2006 12:23 PM by buki79. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-16-2006 09:03 AM

    get value from dropdown list with c#

    Hi,

    how do I get the selecetd value of a dropdown list? This

    string id = thisXDocument.DOM.selectSingleNode("/my:training_administration/my:courses/my:course/my:id").text;


    only returns this error:

    System.NullReferenceException
    Object reference not set to an instance of an object.
    at WBTAnmeldung.WBTAnmeldung.btnViewDetails_OnClick(DocActionEvent e) in d:\vs2003\projects\wbtanmeldung\formcode.cs:line 39
    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


    Any hints?

    Thanks in advance.

    Regards,

    Buki
  • 08-19-2006 12:39 AM In reply to

    Re: get value from dropdown list with c#

    Hi,

    Checked out this link,

    http://infopathdev.com/forums/topic.asp?TOPIC_ID=2895

    I hope this will work for you,
    Thanks.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 08-22-2006 01:34 AM In reply to

    Re: get value from dropdown list with c#

    Hi,

    thanks for the hint, but in this case I don't have to deal with SharePoint. I just want to get the selected value from a dropdown list within an InfoPath form. And there I receive this System.NullReferenceException when I want to retrieve the value.
    I guess this can't be hard to accomplish, but at the moment I'm a bit stuck.

    Regards,

    Buki
  • 08-22-2006 12:15 PM In reply to

    Re: get value from dropdown list with c#

    Hi Buki,
    thisXDocument.DOM.selectSingleNode("/my:training_administration/my:courses/my:course/my:id")
    is not returning the node. Probably your XPath might be wrong. One thing you need to note here is XPath is case sensitive.
  • 08-22-2006 12:23 PM In reply to

    Re: get value from dropdown list with c#

    Hi,

    you're right :) I missed a slash.
    thisXDocument.DOM.selectSingleNode("//my:training_administration/my:courses/my:course/my:id").text
    I'm so blind :) Sorry for bothering.

    Regards,

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