Daniil,
Just in case you still need the actual aspx page to troubleshoot the problem, I'm attaching the aspx files and the window control files. Please notice that I've only included the part where I think the problem is. Also please ignore the included namespaces and the references to the DAO layer. Please let me know. Thanks.
Markup page of main page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BadgerMail.aspx.cs" Inherits="CooliteTestApp.BadgerMail" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Badgermail Setup</title>
<script type="text/javascript">
// this "setGroupStyle" function is called when the GroupingView is refreshed.
var setGroupStyle = function(view) {
// get an instance of the Groups
var groups = view.getGroups();
for (var i = 0; i < groups.length; i++) {
// Loop through the Groups, the do a query to find the <span> with our ColorCode
// Get the "id" from the <span> and split on the "-", the second array item should be our ColorCode
var color = "#" + Ext.query("span", groups[i])[0].id.split("-")[1];
// Set the "background-color" of the original Group node.
Ext.get(groups[i]).setStyle("background-color", color);
}
}
var cellClick = function(grid, rowIndex, columnIndex, e) {
var t = e.getTarget();
var record = grid.getStore().getAt(rowIndex); // Get the Record
var columnId = grid.getColumnModel().getColumnId(columnIndex); // Get column id
if (t.className == 'imgEdit' && columnId == 'Details') {
openBadgermailTypeDetails(record, t);
}
}
var badgermailDetailsRender = function() {
return '<img class="imgEdit" ext:qtip="Click to view additional details" style="cursor:pointer;" src="../images/details.jpg" />';
}
</script>
</head>
<ext:ScriptManager ID="ScriptManager1" runat="server" />
<ext:Store ID="Facility_Store" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="id"></ext:RecordField>
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:Store runat="server" ID="Store1" AutoLoad="true" GroupField="KMSModule">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="BadgermailTypeID"></ext:RecordField>
<ext:RecordField Name="TreeParentID"></ext:RecordField>
<ext:RecordField Name="TypeName"></ext:RecordField>
<ext:RecordField Name="Active"></ext:RecordField>
<ext:RecordField Name="EmailText"></ext:RecordField>
<ext:RecordField Name="SubjectText"></ext:RecordField>
<ext:RecordField Name="BeforeDays"></ext:RecordField>
<ext:RecordField Name="BeforeNotifyFreq"></ext:RecordField>
<ext:RecordField Name="PastdueAfterDays"></ext:RecordField>
<ext:RecordField Name="PastdueNotifyFreq"></ext:RecordField>
<ext:RecordField Name="PastdueMaxNotify"></ext:RecordField>
<ext:RecordField Name="KMSModule"></ext:RecordField>
<ext:RecordField Name="Outline"></ext:RecordField>
<ext:RecordField Name="StatusTableName"></ext:RecordField>
<ext:RecordField Name="ViewName"></ext:RecordField>
<ext:RecordField Name="ViewSyntax"></ext:RecordField>
<%--<ext:RecordField Name="MailHtmlFormatID"></ext:RecordField>--%>
<ext:RecordField Name="ScheduleTask"></ext:RecordField>
<ext:RecordField Name="ScheduleStartDate"></ext:RecordField>
<ext:RecordField Name="ScheduleStartTime"></ext:RecordField>
<ext:RecordField Name="ScheduleNextRunTime"></ext:RecordField>
<ext:RecordField Name="PersonEmailTo"></ext:RecordField>
<ext:RecordField Name="DateCompareTo"></ext:RecordField>
<ext:RecordField Name="InitialNotify"></ext:RecordField>
<ext:RecordField Name="TableKeyColumns"></ext:RecordField>
<ext:RecordField Name="FacilityID"></ext:RecordField>
</Fields>
</ext:ArrayReader>
</Reader>
<SortInfo Field="TypeName" Direction="ASC" />
</ext:Store>
<body>
<form id="BadgerMail_Blank" method="post" runat="server">
<asp:TextBox ID="hidden_ViewName" runat="server" Visible="False" Height="9px"></asp:TextBox>
<table cellspacing="0" cellpadding="0" width="100%" style="height: 100%">
<tr valign="top">
<td>
<div id="Div1" style="position: absolute; left: 5px; right: 5px;">
<ext:GridPanel
ID="GridPanel1"
runat="server"
Collapsible="false"
AutoWidth="true"
Height="350"
AutoExpandColumn="TypeName"
Title="Badgermail Setup"
Frame="true"
StoreID="Store1">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="KMSModule" Header="Badgermail" DataIndex="KMSModule" Width="130" Sortable="true" />
<ext:Column Header="Type Name" DataIndex="TypeName" Width="160" Sortable="true"/>
<ext:Column Header="Email To Person" DataIndex="PersonEmailTo" Sortable="true"></ext:Column>
<ext:Column Header="Subject" DataIndex="EmailText" Width="180" Sortable="true" />
<ext:Column ColumnID="Details" Header="Details" Width="50" Align="Center" Fixed="true" MenuDisabled="true" Resizable="false">
<Renderer Fn="badgermailDetailsRender" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<View>
<ext:GroupingView
ID="GroupingView1"
HideGroupedColumn="true"
runat="server"
ForceFit="true"
StartCollapsed="true"
GroupTextTpl='<span id="ColorCode-{[values.rs[0].data.ColorCode]}"></span>{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Types" : "Type"]})'
EnableRowBody="true">
<Listeners>
<Refresh Fn="setGroupStyle" />
</Listeners>
</ext:GroupingView>
</View>
<Buttons>
<ext:Button
ID="btnToggleGroups"
runat="server"
Text="Expand/Collapse Groups"
Icon="TableSort"
Style="margin-left: 6px;"
AutoPostBack="false">
<Listeners>
<Click Handler="#{GridPanel1}.getView().toggleAllGroups();" />
</Listeners>
</ext:Button>
</Buttons>
<Listeners>
<CellClick Fn="cellClick" />
</Listeners>
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button ID="btnAddNewType" runat="server" Icon="Add" Text="Add New Badgermail Setup type"></ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:GridPanel>
<uc1:WindowEditor ID="WindowEditor1" runat="server" />
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
Code behind of main page
if (!Page.IsPostBack || !Ext.IsAjaxRequest)
{
BadgerMailDAO dao = new BadgerMailDAO(this.GetDBAlias());
KmsUser currentUser = KmsPageController.GetCurrentUser(Session);
ArrayList bmDataList = dao.SelectAllExistingBM(currentUser.FacilityID.ToString());
List<object> badgermailList = new List<object>(bmDataList.Count);
foreach (NewBadgerMail bm in bmDataList)
{
badgermailList.Add(new object[] { bm.TypeID, bm.ParentId, bm.TypeName, bm.ActiveYN, bm.EmailBody, bm.EmailSubject,
bm.BeforeTargetDate, bm.BeforeNotifyFreq, bm.PastDue, bm.PastDueNotifyFreq, bm.PastDueNotifyMaxTime,
bm.Module, bm.Outline, bm.TableName, bm.ViewName, bm.ViewDef, bm.ScheduleTask,
bm.StartDate, bm.StartTime, bm.NextRunTime, bm.EmailSendTo, bm.DateCompareTo,
bm.InitialNotifyYN, bm.TableKeyColumns, bm.FacilityID });
}
this.Store1.DataSource = badgermailList;
this.Store1.DataBind();
}
WindowEditor mockup page
if (!Page.IsPostBack || !Ext.IsAjaxRequest)
{
BadgerMailDAO dao = new BadgerMailDAO(this.GetDBAlias());
KmsUser currentUser = KmsPageController.GetCurrentUser(Session);
ArrayList bmDataList = dao.SelectAllExistingBM(currentUser.FacilityID.ToString());
List<object> badgermailList = new List<object>(bmDataList.Count);
foreach (NewBadgerMail bm in bmDataList)
{
badgermailList.Add(new object[] { bm.TypeID, bm.ParentId, bm.TypeName, bm.ActiveYN, bm.EmailBody, bm.EmailSubject,
bm.BeforeTargetDate, bm.BeforeNotifyFreq, bm.PastDue, bm.PastDueNotifyFreq, bm.PastDueNotifyMaxTime,
bm.Module, bm.Outline, bm.TableName, bm.ViewName, bm.ViewDef, bm.ScheduleTask,
bm.StartDate, bm.StartTime, bm.NextRunTime, bm.EmailSendTo, bm.DateCompareTo,
bm.InitialNotifyYN, bm.TableKeyColumns, bm.FacilityID });
}
this.Store1.DataSource = badgermailList;
this.Store1.DataBind();
}
WindowEditor code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Com.Dss.Kms.BadgerMail.BusinessLogic;
using Coolite.Ext.Web;
using Com.Dss.Kms.BadgerMail.DAO;
using Com.Dss.Kms.Common;
using Com.Dss.Kms.Common.DAO;
using System.Collections;
namespace Com.Dss.Kms.BadgerMail.Controls
{
public partial class WindowEditor : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.LoadFacilityList();
}
}
/// <summary>
///
/// </summary>
private void LoadFacilityList()
{
//Load Facility Combo box
CommonDAO cDAO = new CommonDAO((string)Session[SessionValues.DB_ALIAS]);
ArrayList facilityList = cDAO.SelectFacilityList();
List<object> cbFacilityList = new List<object>(facilityList.Count);
foreach (System.Web.UI.WebControls.ListItem item in facilityList)
{
cbFacilityList.Add(new object[] { item.Value, item.Text });
}
FacilityStore.DataSource = cbFacilityList;
FacilityStore.DataBind();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[AjaxMethod]
public void LoadFieldsByID(object sender, AjaxEventArgs e)
{
try
{
//populate Displayfields
string nodeid = Session["BadgerMailID"].ToString();
string facID = this.cbFacility.SelectedItem.Value;
BadgerMailDAO DAO = new BadgerMailDAO((string)Session[SessionValues.DB_ALIAS]);
DataTable dtable = DAO.SelectExistingDisplayFields(nodeid, facID);
System.Data.DataView dv = new System.Data.DataView(dtable);
if (dv.Count > 0)
{
int loop_count = 0;
ArrayList checkboxIds = new ArrayList();
foreach (DataRowView drv in dv)
{
string column_name = drv["COLUMN_NAME"].ToString();
string Assign_YN = drv["ASSIGNED_YN"].ToString();
//cbgDisplayField.Items.Add(new Checkbox(false, column_name + loop_count.ToString()));
//cblDisplayFields.Items.Add(column_name);
//if (Assign_YN == "Y")
//{
// cbgDisplayField.Items[loop_count].Checked = true;
//}
//else
// cbgDisplayField.Items[loop_count].Checked = false;
checkboxIds.Add(column_name + loop_count.ToString());
loop_count++;
//Coolite.Ext.Web.ScriptManager.GetInstance(this.Context).AddScript("addCheckboxTo('{0}', '{1}');", "cbgDisplayFields.ClientID", column_name);
}
string jsonCheckboxIds = JSON.Serialize(checkboxIds);
Coolite.Ext.Web.ScriptManager.GetInstance(this.Context).AddScript("addCheckboxTo('{0}', '{1}');", "cbgDisplayFields.ClientID", jsonCheckboxIds);
return true;
}
else
return false;
}
catch (Exception ex)
{
throw ex;
}
}
}
}