<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Programmatically populate a Drop-Down List Box</title><link>https://www.infopathdev.com:443/forums/thread/52990.aspx</link><pubDate>Mon, 22 Mar 2010 13:43:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52990</guid><dc:creator>elizas</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52990.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=52990</wfw:commentRss><description>1. From ServerSide (In c#)

         To change ListBox to DropDownList just change the Rows property of the ListBox with “1” Then it will behave as the Dropdown list in UI.
               → ListBox1.Rows = 1;

For the reverse Add 
               → DropDownList1.Attributes.Add(&amp;quot;size&amp;quot;, &amp;quot;3&amp;quot;);

2. In ClientSide (By Javascript)
           DropDownList &amp;amp; Listbox Both rendered as select in the browser differentiate in their size property. So to change the UI of DropDownList to ListBox just change this property
 
      




function ToggleView()
{
     document.getElementById(&amp;#39;ListBox1&amp;#39;).size = 1; // This will Change from listBox to Dropdown List.
     document.getElementById(&amp;#39;DropDownList1&amp;#39;).size = 3;// This will Change from Dropdown List to listBox.
} 



           A small may be useful idea can be:  Save the page space by showing the options  in a DropDownList &amp;amp; on mousover change it to listbox &amp;amp; again on mouseout do the reverse.
Here is the sample code



Option 1
Option 2
Option 3


http://www.mindfiresolutions.com/Change-the-UI-of-ListBox-and-DropDownList-on-the-fly-853.php</description></item><item><title>Re: Programmatically populate a Drop-Down List Box</title><link>https://www.infopathdev.com:443/forums/thread/32715.aspx</link><pubDate>Thu, 02 Oct 2008 06:16:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:32715</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/32715.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=32715</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;We can pass the parameters to stored procedure using code as below,&lt;/p&gt;
&lt;p&gt;SqlCommand sqlCommand = new SqlCommand(&amp;quot;Stroed Procedure Name&amp;quot;, sqlConnection);&lt;/p&gt;
&lt;p&gt;sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;&lt;/p&gt;
&lt;p&gt;sqlCommand.Parameters.Add(sqlParameter);&lt;/p&gt;</description></item><item><title>Re: Programmatically populate a Drop-Down List Box</title><link>https://www.infopathdev.com:443/forums/thread/24770.aspx</link><pubDate>Wed, 28 Nov 2007 22:44:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24770</guid><dc:creator>MonkeyCMonkeyDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24770.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=24770</wfw:commentRss><description>&lt;p&gt;Clay,&lt;/p&gt;
&lt;p&gt;My data connection is working properly because I can use the same stored proc with different parameters to fill textboxes.&lt;/p&gt;
&lt;p&gt;Everything I am doing is behind in code...I&amp;#39;m using ADO.NET (C#) a sqlDataReader to read in the data.&lt;/p&gt;
&lt;p&gt;I would use the InfoPath UI to set the values of the dropdown, but I need it to be dynamic as possible, and I don&amp;#39;t want to hard-code the parameters in the &amp;#39;edit sql&amp;#39; of the data connection.&amp;nbsp; If there is a way to pass a value from the form to the &amp;#39;edit sql&amp;#39; in the data connection wizard that would solve my problem.&lt;/p&gt;
&lt;p&gt;Thank you for the response Clay...you&amp;#39;re awesome!!&lt;/p&gt;</description></item><item><title>Re: Programmatically populate a Drop-Down List Box</title><link>https://www.infopathdev.com:443/forums/thread/24765.aspx</link><pubDate>Wed, 28 Nov 2007 22:23:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24765</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24765.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=24765</wfw:commentRss><description>&lt;p&gt;First step would be to verify your data connection is performing properly.&lt;/p&gt;
&lt;p&gt;Are you setting up your Data Connection in InfoPath or doing it behind in code?&lt;/p&gt;
&lt;p&gt;In the InfoPath UI you would just det the dropdown to use the secondary data connection. You would need to requery oviously to get the data updated as you needed.&lt;/p&gt;
&lt;p&gt;I have not&amp;nbsp;configured a drop down control in code.&lt;/p&gt;</description></item><item><title>Programmatically populate a Drop-Down List Box</title><link>https://www.infopathdev.com:443/forums/thread/24753.aspx</link><pubDate>Wed, 28 Nov 2007 17:32:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24753</guid><dc:creator>MonkeyCMonkeyDo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24753.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=24753</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am trying to populate a Drop-Down List Box with values I receive from an ADO.NET connection behind InfoPath.&amp;nbsp; I am hitting a Stored Proc with 4 parameters and will received back a list of numbers, I would like those number to populate my Drop-Down List Box.&amp;nbsp; Depending on what view I&amp;#39;m at those parameters will change and so will the list of numbers.&amp;nbsp; Any advice would be far beyond appreciated at this point!&lt;/p&gt;
&lt;p&gt;Thank you:)&lt;/p&gt;</description></item></channel></rss>