I need to use custom action to load items into combobox.
UI.wxs:
<Control Id="Server" Type="ComboBox" X="30" Y="65" Width="200" Height="18" Property="DATABASE_SERVER">
<ComboBox Property="DATABASE_SERVER">
<ListItem Text="[DATABASE_SERVER]" Value="[DATABASE_SERVER]" />
</ComboBox>
<Publish Property="LOGON_VALID" Value="0">1</Publish>
</Control>
Custom Action
private static ActionResult EnumSqlServersIntoComboBox(Session session, IEnumerable<DataRow> rows)
{
try
{
Debugger.Break();
session.Log("EnumSQLServers: Begin");
// Grab the combo box but make sure I'm getting only the one
// from WebAppInstallDlg.
View view = session.Database.OpenView("SELECT * FROM ComboBox WHERE ComboBox.Property='DATABASE_SERVER'");
view.Execute();
Int32 index = 1;
session.Log("EnumSQLServers: Enumerating SQL servers");
foreach (DataRow row in rows)
{
String serverName = row["Name"].ToString();
// Create a record for this web site. All I care about is
// the name so use it for fields three and four.
session.Log("EnumSQLServers: Processing SQL server: {0}", serverName);
Record record = session.Database.CreateRecord(4);
record.SetString(1, "DATABASE_SERVER");
record.SetInteger(2, index);
record.SetString(3, serverName);
record.SetString(4, serverName);
session.Log("EnumSQLServers: Adding record");
view.Modify(ViewModifyMode.InsertTemporary, record);
index++;
}
view.Close();
session.Log("EnumSQLServers: End");
}
catch (Exception ex)
{
session.Log("EnumSQLServers: exception: {0}", ex.Message);
throw;
}
return ActionResult.Success;
}
What I'm trying to achieve is to have a input text box with drop down arrow next to it with all loaded sql servers.
The only time sql servers get loaded into combobox is when I change my UI code to this:
<Control Type="ComboBox" Property="DATABASE_SERVER" Id="Server" Width="180" Height="16" X="110" Y="60" ComboList="yes" Sorted="yes" />
Notice ComboList="yes" item. BUT this won't work for me since this makes the combobox a drop down item and I want to be able to "TYPE" in alternate option.
I figured it out:
Dialogs.wxs:
CustomAction: