<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14588.aspx</link><pubDate>Wed, 07 Jun 2006 05:42:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14588</guid><dc:creator>val3</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14588.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14588</wfw:commentRss><description>Dear Matt or someone else,&lt;br /&gt;&lt;br /&gt;please reply to my last post.&lt;br /&gt;&lt;br /&gt;Thanks in advance,&lt;br /&gt;B.</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14587.aspx</link><pubDate>Fri, 02 Jun 2006 12:43:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14587</guid><dc:creator>val3</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14587.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14587</wfw:commentRss><description>ok, I have a callback every time I select an item form the dropdown listobx, but the sSelectedValue is always empty. Why?</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14586.aspx</link><pubDate>Fri, 02 Jun 2006 12:10:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14586</guid><dc:creator>val3</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14586.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14586</wfw:commentRss><description>Thanks Matt for the how-to link, thay are really interesting. My only problem is that I want to use managed code (C#). I was able to build the form described in the 2nd how to, but I don't know how to set the selected item:&lt;br /&gt;"You will need to use the sSelectedValue parameter to identify which of the option elements is the currently selected option. You must make sure that, in your code, you set the selected="selected" attribute on the correct option element. Otherwise the drop-down list in the view will never show the selected value, but will instead always revert back to displaying the first option in the list."&lt;br /&gt;How can I do that?&lt;br /&gt;&lt;br /&gt;Thanks again in advance,&lt;br /&gt;B.</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14585.aspx</link><pubDate>Mon, 29 May 2006 21:34:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14585</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14585.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14585</wfw:commentRss><description>Val3,&lt;br /&gt;&lt;br /&gt;Please check out these HowTos:&lt;a target="_blank" href=http://infopathdev.com/howto/tutorials/default.aspx?i=987250af134b4ced85cbddc7db724202&gt;http://infopathdev.com/howto/tutorials/default.aspx?i=987250af134b4ced85cbddc7db724202&lt;/a&gt;&lt;br /&lt;a target="_blank" href=http://infopathdev.com/howto/tutorials/default.aspx?i=7f693c75c5c94604b01bdfd3a1edaedc&gt;http://infopathdev.com/howto/tutorials/default.aspx?i=7f693c75c5c94604b01bdfd3a1edaedc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Agni is talking about setting up the drop-down to populate from a 2DS as described in the second HowTo, and then to edit the entries in the drop-down add and remove nodes to the 2DS with code.  Do it this way, however, will need to be done every time the form is opened as changes to the 2DS are not saved with the template./</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14584.aspx</link><pubDate>Mon, 29 May 2006 19:45:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14584</guid><dc:creator>val3</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14584.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14584</wfw:commentRss><description>Can you specify in more detail what should I do? Can you give me a codesnippet?&lt;br /&gt;&lt;br /&gt;Thanks for your precious time helping me in advance,&lt;br /&gt;B.</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14583.aspx</link><pubDate>Mon, 29 May 2006 04:28:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14583</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14583.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14583</wfw:commentRss><description>Yes. You will prepare a dummy xml file how your secondary datasource will look like and dump the data dynamically into the secondary datasource from the code.</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14582.aspx</link><pubDate>Sun, 28 May 2006 09:07:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14582</guid><dc:creator>val3</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14582.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14582</wfw:commentRss><description>&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;&lt;i&gt;Originally posted by Agni Jonnalagadda&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Hi,&lt;br /&gt;Welcome to the Forum!&lt;br /&gt;You cannot get reference to the Node that is bound to a dropdown and set the values for the dropdown. You either need to fill in a secondary datasource file with the that you have and bind that secodnary datasource node to the dropdown in the Infopath design.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;&lt;br /&gt;Thanks. How can I do that? :) I have to create some kond of dummy secoundary data source, than change the bind to a real one in code?</description></item><item><title>Re: populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/14581.aspx</link><pubDate>Fri, 26 May 2006 20:34:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14581</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14581.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14581</wfw:commentRss><description>Hi,&lt;br /&gt;Welcome to the Forum!&lt;br /&gt;You cannot get reference to the Node that is bound to a dropdown and set the values for the dropdown. You either need to fill in a secondary datasource file with the that you have and bind that secodnary datasource node to the dropdown in the Infopath design.&lt;br /&gt;&lt;br /&gt;</description></item><item><title>populate a dropdown listbox with C#</title><link>https://www.infopathdev.com:443/forums/thread/12876.aspx</link><pubDate>Fri, 26 May 2006 12:59:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12876</guid><dc:creator>val3</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12876.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12876</wfw:commentRss><description>Hi!&lt;br /&gt;&lt;br /&gt;	I want to populate a dropdown listbox from SQL with C#. This is my code so far:&lt;br /&gt;&lt;br /&gt;IXMLDOMNode nodeEmployees = thisXDocument.DOM.selectSingleNode("my:myFields/my:employees");&lt;br /&gt;//workersOnDepartment is a dropdown listbox&lt;br /&gt;&lt;br /&gt;Command.CommandText = "SELECT dbo.Employees.Name FROM dbo.Employees";&lt;br /&gt;SqlDataReader Reader5 = Command.ExecuteReader();&lt;br /&gt;&lt;br /&gt;while (Reader5.Read())&lt;br /&gt;{&lt;br /&gt;// HOW TO populate the nodeEmployees dropdown listbox //Reader5.GetValue(0).ToString() is contains employee name&lt;br /&gt;}&lt;br /&gt;Reader5.Close();&lt;br /&gt;&lt;br /&gt;Thanks for any help in advance.&lt;br /&gt;</description></item></channel></rss>