MSI-Wix combobox

Hi Experts,
 
I have a custom action that shows list of application pools in the system and want to bind these values into combobox which is inside customdlg.wxs and while executing MSI setup I should get a combobox that show list of app pools.

Please guide me how to bind custom action values to combobox in WIX?
custom action
//List all App pools    
public static ActionResult GetAppPools(Session session)
{
    using (ServerManager iisMgr=new ServerManager())
    {
        System.Collections.IEnumerator ie = iisMgr.ApplicationPools.GetEnumerator();
        List<string> apppools = new List<string>();

        while (ie.MoveNext())
        {
            apppools.Add(((Microsoft.Web.Administration.ApplicationPool)(ie.Current)).Name);
        }
    }
    return ActionResult.Success;
}

Open in new window


customdlg.wxs

<Control Id="ApplicationPoolLabel" Type="Text" Y="94" X="11" Width="349"  Height="16" TabSkip="no" Text="Application Pool: " />
<Control Id="ApplicationPoolCombo" Type="ComboBox" Y="94" X="100" Width="150" Height="16" ToolTip="Application Pool" Property="APP_POOL" Text="{80}">
    <ComboBox Property="APP_POOL">
        <ListItem Text="[APP_POOL]" Value="[APP_POOL]" />
    </ComboBox>
</Control>

Open in new window

ksd123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vadim RappCommented:
Your custom action needs to populate table "combobox". Here's an example.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ksd123Author Commented:
Thank you.I just followed the above example and here is the updated code for filling app pools in the combobox.Please correct me if I miss anything.

 
[CustomAction]
        public static ActionResult FillApplicationPools(Session session)
        {
            if (null == session)
            {
                throw new ArgumentNullException("session");
            }
           
            // Debugger.Launch();
            
            View iview = session.Database.OpenView("SELECT * FROM ComboBox");
            iview.Execute();
            int lIndex = 1;

            DirectoryEntries appPools = new DirectoryEntry("IIS://localhost/W3SVC/AppPools").Children;
               
            foreach (DirectoryEntry appPool in appPools)
            {
               
                string applicationPoolName = appPool.Name;
                Record record = session.Database.CreateRecord(4);
                record.SetString(1, "APP_POOL");
                record.SetInteger(2, lIndex);
                record.SetString(3, applicationPoolName);
                record.SetString(4, applicationPoolName);
                iview.Modify(ViewModifyMode.InsertTemporary, record);
                ++lIndex;
            }

            iview.Close();
            return ActionResult.Success;
}

Open in new window


I have a question in the above stackflow example we have following code and did not understand why I need this and have  ignored while filling app pools in the combobox. Can you comment on this?

        ActionResult result;

        DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
        DataRow[] rows = dt.Select(string.Empty, "IsLocal desc, Name asc");
        result = EnumSqlServersIntoComboBox(session, rows);
         return result;

Open in new window

0
Vadim RappCommented:
Because in their example they populated combobox with the names of available sql servers.
0
ksd123Author Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.