Hi vladimir,
Thank you for the quick reply.
Your test case is exactly how I have my code setup. Below is most of the code on my pages.
I did think about using store but I thought that would be a little more work adding items to a store through a for loop. Anyways, I will give that a try again.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditPublicationDetails.ascx.cs" Inherits="EditPublicationDetails" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
<ext:Store ID="StorePublicationType" runat="server" AutoLoad="false">
<Reader>
<ext:JsonReader ReaderID="PublicationTypeCode">
<Fields>
<ext:RecordField Name="PublicationTypeName" />
<ext:RecordField Name="PublicationTypeCode" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Store ID="StoreSubPublicationType" runat="server">
<Reader>
<ext:JsonReader ReaderID="SubPublicationTypeCode">
<Fields>
<ext:RecordField Name="SubPublicationTypeName" />
<ext:RecordField Name="SubPublicationTypeCode" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Window
id="EditPublicationWindow"
runat="server"
Icon="ApplicationFormEdit"
Title="Edit Publication Details"
Width="550"
Height="350"
AutoShow="false"
Modal="true"
Hidden="true"
Layout="Fit"
AutoScroll="true">
<Body>
<ext:Panel
runat="server"
ID="pnlEditPanel"
Padding="5"
Layout="Form">
<Body>
<div class="padding">
<ext:Panel Cls="block" id="divPublicationTypes" runat="server" Border="false">
<Body>
<span class="editLabel">
<ext:Label Text="Publication Type: " ID="lblPublicationTypes" runat="server" />
</span>
<div class="editParameter">
<ext:ComboBox ID="ddlPublicationTypes"
runat="server"
StoreID="StorePublicationType"
ValueField="PublicationTypeCode"
DisplayField="PublicationTypeName"
Width="150">
</ext:ComboBox>
</div>
</Body>
</ext:Panel>
<ext:Panel Cls="block" id="divSubPublicationTypes" runat="server" Border="false">
<Body>
<span class="editLabel">
<ext:Label Text="Sub-Publication Type: " ID="lblSubPublication" runat="server" />
</span>
<div class="editParameter">
<ext:ComboBox ID="ddlSubPublicationTypes"
runat="server"
StoreID="StoreSubPublicationType"
ValueField="SubPublicationTypeCode"
DisplayField="SubPublicationTypeName"
Width="150" />
</div>
</Body>
</ext:Panel>
<ext:Panel Cls="block" id="divStartDate" runat="server" Border="false">
<Body>
<span class="editLabel">
<ext:Label ID="lblStartDate" runat="server" Text="Start Date: " />
</span>
<div class="editParameter">
<ext:ComboBox runat="server" ID="ddlPublicationMonths" Width="100">
<Items>
<ext:ListItem Text=" " Value="0"></ext:ListItem>
<ext:ListItem Text="January" Value="1"></ext:ListItem>
<ext:ListItem Text="February" Value="2"></ext:ListItem>
<ext:ListItem Text="March" Value="3"></ext:ListItem>
<ext:ListItem Text="April" Value="4"></ext:ListItem>
<ext:ListItem Text="May" Value="5"></ext:ListItem>
<ext:ListItem Text="June" Value="6"></ext:ListItem>
<ext:ListItem Text="July" Value="7"></ext:ListItem>
<ext:ListItem Text="August" Value="8"></ext:ListItem>
<ext:ListItem Text="September" Value="9"></ext:ListItem>
<ext:ListItem Text="October" Value="10"></ext:ListItem>
<ext:ListItem Text="November" Value="11"></ext:ListItem>
<ext:ListItem Text="December" Value="12"></ext:ListItem>
</Items>
</ext:ComboBox>
</div>
<div class="editParameter">
<ext:ComboBox runat="server" ID="ddlPublicationDays" Width="50">
</ext:ComboBox>
</div>
<div class="editParameter">
<ext:ComboBox runat="server" ID="ddlPublicationYears" Width="60">
</ext:ComboBox>
</div>
</Body>
</ext:Panel>
<ext:Panel Cls="block" id="divEndDate" runat="server" Border="false">
<Body>
<span class="editLabel">
<ext:Label runat="server" Text="End Date: " ID="lblEndDate" />
</span>
<div class="editParameter">
<ext:ComboBox runat="server" ID="ddlEndPublicationMonths" Width="100">
<Items>
<ext:ListItem Text=" " Value="0"></ext:ListItem>
<ext:ListItem Text="January" Value="1"></ext:ListItem>
<ext:ListItem Text="February" Value="2"></ext:ListItem>
<ext:ListItem Text="March" Value="3"></ext:ListItem>
<ext:ListItem Text="April" Value="4"></ext:ListItem>
<ext:ListItem Text="May" Value="5"></ext:ListItem>
<ext:ListItem Text="June" Value="6"></ext:ListItem>
<ext:ListItem Text="July" Value="7"></ext:ListItem>
<ext:ListItem Text="August" Value="8"></ext:ListItem>
<ext:ListItem Text="September" Value="9"></ext:ListItem>
<ext:ListItem Text="October" Value="10"></ext:ListItem>
<ext:ListItem Text="November" Value="11"></ext:ListItem>
<ext:ListItem Text="December" Value="12"></ext:ListItem>
</Items>
</ext:ComboBox>
</div>
<div class="editParameter">
<ext:ComboBox runat="server" ID="ddlEndPublicationDays" DisplayField="Value" Width="50">
</ext:ComboBox>
</div>
<div class="editParameter">
<ext:ComboBox runat="server" ID="ddlEndPublicationYears" Width="60">
</ext:ComboBox>
</div>
</Body>
</ext:Panel>
</div>
</Body>
</ext:Panel>
</Body>
<Buttons>
<ext:Button ID="SaveButton" runat="server" Text="Save" Icon="Disk">
<AjaxEvents>
<Click OnEvent="SavePublicationEdit" Failure="Ext.MessageBox.alert('Saving failed', 'Error during ajax event');">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{EditPublicationWindow}.body}" />
<ExtraParams>
<ext:Parameter Name="id" Value="#{PublicationID}.getValue()" Mode="Raw" />
</ExtraParams>
</Click>
</AjaxEvents>
</ext:Button>
<ext:Button ID="CancelButton" runat="server" Text="Cancel" Icon="Cancel">
<Listeners>
<Click Handler="#{EditPublicationWindow}.hide(null);" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
CODE BEHIND
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class EditPublicationDetails : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
this.EditPublicationWindow.Hide();
}
// Setup the Edit Window
public void SetupEditWIndow(Int32 pubID)
{
this.txtPublicationID.Text = pubID.ToString();
PublicationBLL publicationBLL = new PublicationBLL();
Publication editPublication = new Publication();
editPublication = publicationBLL.getPublicationByID(pubID);
if (editPublication != null)
{
pnlEditPanel.Visible = true;
hideAllPanels();
fillPublicationTypeDropDown();
if (editPublication.SubPublicationTypeCode.Trim().ToString() != "")
{
String publicationCode = editPublication.SubPublicationTypeCode.Trim().ToString();
getAttributes(publicationCode);
ChangeLabels(publicationCode);
String parentPublicationCode = editPublication.PublicationTypeCode.Trim().ToString();
// Sub Publication DDL is generate from the value of the Publication Type
fillSubPublicationTypeDropDown(parentPublicationCode, publicationCode);
divSubPublicationTypes.Hidden = false;
}
else
{
divSubPublicationTypes.Hidden = true;
String publicationCode = editPublication.PublicationTypeCode.ToString();
getAttributes(publicationCode);
ChangeLabels(publicationCode);
}
assignPublicationValues(editPublication);
fillDateDropDowns();
}
else
{
this.EditPublicationWindow.Hide();
}
}
// Show Edit Publication Window
public void ShowEditWindow()
{
this.EditPublicationWindow.Show();
}
public void SavePublicationEdit(object sender, EventArgs e)
{
}
// Fill Publication DDL
public void fillPublicationTypeDropDown()
{
PublicationTypeBLL publicationTypeBLL = new PublicationTypeBLL();
List<PublicationType> publicationTypeList = new List<PublicationType>();
publicationTypeList = publicationTypeBLL.getAllPublicationTypes();
StorePublicationType.DataSource = publicationTypeList;
StorePublicationType.DataBind();
}
// Fill Sub-Publication DDL on Publication Change
protected void fillSubPublicationTypeDropDown(String parentPublicationCode, String subPublicationTypeCode)
{
PublicationTypeBLL subPublicationTypeBLL = new PublicationTypeBLL();
List<PublicationType> subPublicationTypeList = new List<PublicationType>();
subPublicationTypeList = subPublicationTypeBLL.getSubPublicationTypes(parentPublicationCode);
if (subPublicationTypeList != null)
{
hideAllPanels();
StoreSubPublicationType.DataSource = subPublicationTypeList;
StoreSubPublicationType.DataBind();
this.ddlSubPublicationTypes.SelectedItem.Value = subPublicationTypeCode;
getAttributes(subPublicationTypeCode);
}
else
{
divSubPublicationTypes.Hidden = true;
getAttributes(parentPublicationCode);
}
ChangeLabels(parentPublicationCode);
}
public void fillDateDropDowns()
{
//fill day drop down list
for (int i = 1; i <= 31; i++)
{
ddlEndPublicationDays.Items.Add(new Coolite.Ext.Web.ListItem(i.ToString(), i.ToString()));
ddlPublicationDays.Items.Add(new Coolite.Ext.Web.ListItem(i.ToString(), i.ToString()));
}
//fill year drop down list with current year and previous year (default to previous year)
Coolite.Ext.Web.ListItem year = new Coolite.Ext.Web.ListItem();
year.Text = (DateManager.GetCurrentYear() - 1).ToString();
year.Value = (DateManager.GetCurrentYear() - 1).ToString();
ddlPublicationYears.Items.Add(year);
ddlEndPublicationYears.Items.Add(year);
year.Text = DateManager.GetCurrentYear().ToString();
year.Value = DateManager.GetCurrentYear().ToString();
ddlPublicationYears.Items.Add(year);
ddlEndPublicationYears.Items.Add(year);
//ddlPublicationYears.SelectedItem.Value = (DateManager.GetCurrentYear() - 1).ToString();
}
Thank you!