Hello,
i have 4 Listboxes, the first Listbox Filled up with Initial Data:
<div class="listboxcontrol">
<!--parent listbox element-->
<ej:ListBox ID="MainDatabase" runat="server" ShowRoundedCorner="True" OnValueSelect="MainDatabase_ValueSelect">
<Items>
<ej:ListBoxItems Id="Attributes" Text="Attribute">
</ej:ListBoxItems>
<ej:ListBoxItems Id="Blueprints" Text="Baupläne"></ej:ListBoxItems>
</Items>
</ej:ListBox>
</div>
<div class="listboxcontrol">
<!-- First level child listbox element-->
<ej:ListBox ID="Groups" runat="server" ShowRoundedCorner="True" EmptyDataText=".."></ej:ListBox>
</div>
<div class="listboxcontrol">
<!-- second level child listbox element-->
<ej:ListBox ID="SubGroups" runat="server" ShowRoundedCorner="True" EmptyDataText="..."></ej:ListBox>
</div>
<div class="listboxcontrol">
<!-- second level child listbox element-->
<ej:ListBox ID="Entry" runat="server" ShowRoundedCorner="True" EmptyDataText="...."></ej:ListBox>
</div>
Then i Load Data like that:
protected void Page_Load(object sender, EventArgs e)
{
SwitchDatabase( Global._inst.ActiveDatabase );
}
private void SwitchDatabase(string database)
{
switch (database)
{
case "Attributes":
Global._inst.ActiveDatabase = "Attributes";
Groups.DataSource = Global.AttributeDatabase.AttributeGroups;
Groups.DataValueField = "GroupID";
Groups.DataTextField = "Name";
Groups.CascadeTo = "SubGroups";
SubGroups.DataSource = Global.AttributeDatabase.AttributeSubGroups;
SubGroups.DataValueField = "SubGroupID";
SubGroups.DataTextField = "Name";
SubGroups.CascadeTo = "Entry";
SubGroups.LoadDataOnInit = false;
Entry.DataSource = Global.AttributeDatabase.Attributes;
Entry.DataValueField = "AttributeID";
Entry.DataTextField = "Name";
Entry.LoadDataOnInit = false;
break;
case "Blueprints":
Global._inst.ActiveDatabase = "Blueprints";
Groups.DataSource = Global.BlueprintDatabase.BlueprintGroups;
Groups.DataValueField = "GroupID";
Groups.DataTextField = "Name";
Groups.CascadeTo = "SubGroups";
SubGroups.DataSource = Global.BlueprintDatabase.BlueprintSubGroups;
SubGroups.DataValueField = "SubGroupID";
SubGroups.DataTextField = "Name";
SubGroups.CascadeTo = "Entry";
SubGroups.LoadDataOnInit = false;
Entry.DataSource = Global.BlueprintDatabase.Blueprints;
Entry.DataValueField = "BlueprintID";
Entry.DataTextField = "Name";
Entry.LoadDataOnInit = false;
break;
default:
break;
}
}
protected void MainDatabase_ValueSelect(object sender, Syncfusion.JavaScript.Web.ListBoxEventArgs e)
{
ListBox s = sender as ListBox;
switch (s.SelectedItemIndex)
{
case 0:
SwitchDatabase( "Attributes" );
break;
case 1:
SwitchDatabase( "Blueprints" );
break;
default:
SwitchDatabase( "" );
break;
}
}
It work, but when i click the second or third or fourth and then in the first Listbox another entry, only the First Listbox are Shown after Postback.
I find out the other Listboxes are only Hidden but has Data.
What are the Problem, please help.
PS: i must use a Checkbox with AutoPostBack="True" to have an Event on the first Listbox to Show Data in the Second Listbox to use CascadeTo
Martin