Ok, I found the solution for the previous issue: Instead of adding two definitions (one with a view and one with a edit control), I had to add only one definition and there add two Module Controls (one view and one edit control).
Anyways now I am facing the following issue: Although my code seems to be correct, everytime I load the page with the module the same first view appears instead of that one picked by the dropdown in the module settings. My code:
In settings.ascx.cs:
public partial class Settings : DotNetNuke.Entities.Modules.ModuleSettingsBase
{
public override void LoadSettings() {
try
{
if ((Page.IsPostBack == false))
{
if ((TabModuleSettings["employeesql_selectedview"]) == null)
{
TabModuleSettings["employeesql_selectedview"] = 0;
}
ddnViewSelector.SelectedIndex = Convert.ToInt32(TabModuleSettings["employeesql_selectedview"]);
}
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
public override void UpdateSettings()
{
try
{
DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
objModules.UpdateTabModuleSetting(ModuleId, "employeesql_selectedview", Convert.ToString(ddnViewSelector.SelectedIndex));
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
}
In view.ascx.cs:
protected void Page_Load(object sender, System.EventArgs e)
{
if (Page.IsPostBack)
{
}
else
{
ModuleController objModules = new ModuleController();
int goTo = System.Convert.ToInt32(objModules.GetTabModuleSettings(TabModuleId)["employeesql_selectedview"]);
switch (goTo) {
case 0: employeeSQLViews.ActiveViewIndex = 0; break;
case 1: employeeSQLViews.ActiveViewIndex = 1; break;
case 2: employeeSQLViews.ActiveViewIndex = 0; break;
case 3: employeeSQLViews.ActiveViewIndex = 4; break;
case 4: employeeSQLViews.ActiveViewIndex = 2; break;
case 5: employeeSQLViews.ActiveViewIndex = 3; break;
default: employeeSQLViews.ActiveViewIndex = 0; break;
}
}
}