|
Subscribe
|
I'll try and explain this as exact as possible.
I am browsing posting on one form. I select a link from ppostings.aspx(browse) and click on a hyperlink which goes to a NEW form ppost.aspx?id=7(the posting i clicked)
I have worked with Coolite for a few months now, the model viewer/editor (on the same screen) works great... but in this situation I DO NOT have both on the same screen, they are working on SEPARATE screens, it has to be this way.
Page_Load is grabbing the "id" QueryString and running a LoadItem method that I created to do things like:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Load record by ID passed. If (Request.QueryString("id") <> "") Then LoadItem(Request.QueryString("id")) End If End Sub
Protected Sub LoadItem(ByVal PostingID As Long) Dim _col As ProfessorPostingCollection = New ProfessorPostingCollection() Dim item As ProfessorPosting = _col.FindByID(PostingID)
Me.cbSessionList.SetValue(item.SessionCode) Me.cbFacultyList.SetValue(item.FacultyCode) Me.cbDepartmentList.SetValue(item.DepartmentCode) Me.txtPostingID.Text = item.PostingID Me.cbJobClass.SetValue(item.JobClassCode) ....
I have Store's linking to BLL (business logic layer) code using ObjectDataSource as follows, and the Load Handler on stoDepartmentList (Store) is what triggers the session state bugs:
<asp:ObjectDataSource ID="dsSessionList" runat="server" SelectMethod="GetSessionList" TypeName="UOttawa.BusinessObjects.SysParmCollection" OldValuesParameterFormatString="original_{0}" > </asp:ObjectDataSource> <ext:Store ID="stoSessionList" runat="server" DataSourceID="dsSessionList"> <Reader> <ext:JsonReader ReaderID="CodeName"> <Fields> <ext:RecordField Name="CodeName" /> <ext:RecordField Name="CodeValue" /> </Fields> </ext:JsonReader> </Reader> </ext:Store> <asp:ObjectDataSource ID="dsFacultyList" runat="server" SelectMethod="GetFacultyList" TypeName="UOttawa.BusinessObjects.SysParmCollection" OldValuesParameterFormatString="original_{0}" > </asp:ObjectDataSource> <ext:Store ID="stoFacultyList" runat="server" DataSourceID="dsFacultyList"> <Reader> <ext:JsonReader ReaderID="CodeName"> <Fields> <ext:RecordField Name="CodeName" /> <ext:RecordField Name="CodeValue" /> </Fields> </ext:JsonReader> </Reader> </ext:Store>
<asp:ObjectDataSource ID="dsDepartmentList" runat="server" SelectMethod="GetFacultyDepartmentList" TypeName="UOttawa.BusinessObjects.SysParmCollection" OldValuesParameterFormatString="original_{0}" > <SelectParameters> <asp:Parameter DefaultValue="" Name="FacultyCode" Type="String" /> </SelectParameters> </asp:ObjectDataSource> <ext:Store ID="stoDepartmentList" runat="server" DataSourceID="dsDepartmentList" OnRefreshData="LoadDepartmentByFaculty"> <Reader> <ext:JsonReader ReaderID="CodeName"> <Fields> <ext:RecordField Name="CodeName" /> <ext:RecordField Name="CodeValue" /> </Fields> </ext:JsonReader> </Reader> <Listeners> <Load Handler="#{cbDepartmentList}.setValue(this.getAt(0).data[#{cbFacultyList}.valueField]);" /> </Listeners> </ext:Store>
Anything where I use 'SetValue' for a ComboBox or DateField is not loading properly on Page_Load event, and the ComboBox's do NOT save the session state of itself.
Here is what I mean:
Me.cbSessionList.SetValue(item.SessionCode)
Me.cbFacultyList.SetValue(item.FacultyCode)
Me.cbDepartmentList.SetValue(item.DepartmentCode)
These values as stated above, I load upon Page_Load it sets the 'default value' of the ComboBox ie. Session - 20101, Faculty - ARTS, Department - ARV... when I select a faculty without storing its session state from the OnRefreshData="LoadDepartmentByFaculty" method like this:
Protected Sub LoadDepartmentByFaculty(ByVal sender As Object, ByVal e As StoreRefreshDataEventArgs) Me.cbSessionList.SetValue(Me.cbSessionList.SelectedItem.Value) Me.cbFacultyList.SetValue(Me.cbFacultyList.SelectedItem.Value) Me.cbDepartmentList.SetValue(Me.cbDepartmentList.SelectedItem.Value) Me.cbJobClass.SetValue(Me.cbJobClass.SelectedItem.Value) dsDepartmentList.SelectParameters("FacultyCode").DefaultValue = Me.cbFacultyList.SelectedItem.Value dsDepartmentList.DataBind() End Sub
To me, I shouldn't need to set the value of the Session, Faculty, Department on my own, it should happen at the same time it is changed in the ComboBox... for example, I start off with Page_Load Session - Winter 2010, Faculty of Arts and Visual Arts, I select a different session Fall 2010. Then if I choose a new Faculty without "Me.cbSessionList.SetValue(Me.cbSessionList.SelectedItem.Value)" line of code it whipes out Fall 2010 and reverts back to the Page_Load value of 'Winter 2010' weird isn't it?
Has anyone else had problems saving session state of ComboBox and DateField? This is a BIG issue, and to me is a problem with Coolite's behavior and session state handling, in my opinion it is not up to the developer to track which ComboBox have changed since Page_Load, at least that's not the Microsoft .NET way of things.
If you're able to respond with VB.NET or C# examples, I know both. thank you kindly, ---James
|
|
|
Hi James,
I've spent some time trying to figure out what you're doing based upon your description and piece together a sample that attempts to reproduce any Session issues with the ComboBox. So far this is what I have.
Example
<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script runat="server"> protected void Page_Load(object sender, EventArgs e) { if (!Ext.IsAjaxRequest) { object session = this.Session["Session"];
if (session != null) { this.Label1.Text = session.ToString(); this.ComboBox1.SetValue(session); }
object faculty = this.Session["Faculty"];
if (faculty != null) { this.Label2.Text = faculty.ToString(); this.ComboBox2.SetValue(faculty); }
object department = this.Session["Department"];
if (department != null) { this.Label3.Text = department.ToString(); this.ComboBox3.SetValue(department); } } }
protected void Button1_Click(object sender, AjaxEventArgs e) { this.Session["Session"] = this.ComboBox1.SelectedItem.Value; this.Session["Faculty"] = this.ComboBox2.SelectedItem.Value; this.Session["Department"] = this.ComboBox3.SelectedItem.Value; }
protected void Button2_Click(object sender, AjaxEventArgs e) { this.Session["Session"] = null; this.Session["Faculty"] = null; this.Session["Department"] = null; } </script>
<!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 id="Head1" runat="server"> <title>Coolite Toolkit Example</title> </head> <body> <form id="form1" runat="server"> <ext:ScriptManager ID="ScriptManager1" runat="server" /> <a href="Simple2.aspx">Reload</a> <ext:Panel ID="Panel1" runat="server" Width="400" AutoHeight="true" Title="Title" BodyStyle="padding:6px;"> <Body> <ext:FormLayout runat="server"> <Anchors> <ext:Anchor Horizontal="100%"> <ext:ComboBox ID="ComboBox1" runat="server" FieldLabel="Session"> <Items> <ext:ListItem Text="Spring" /> <ext:ListItem Text="Summer" /> <ext:ListItem Text="Fall" /> <ext:ListItem Text="Winter" /> </Items> </ext:ComboBox> </ext:Anchor> <ext:Anchor Horizontal="100%"> <ext:ComboBox ID="ComboBox2" runat="server" FieldLabel="Faculty"> <Items> <ext:ListItem Text="Arts" /> <ext:ListItem Text="Bussiness" /> <ext:ListItem Text="Medicine" /> <ext:ListItem Text="Engineering" /> </Items> </ext:ComboBox> </ext:Anchor> <ext:Anchor Horizontal="100%"> <ext:ComboBox ID="ComboBox3" runat="server" FieldLabel="Department"> <Items> <ext:ListItem Text="101" /> <ext:ListItem Text="201" /> <ext:ListItem Text="301" /> <ext:ListItem Text="401" /> </Items> </ext:ComboBox> </ext:Anchor> </Anchors> </ext:FormLayout> </Body> <Buttons> <ext:Button ID="Button1" runat="server" Text="Set Session Values"> <AjaxEvents> <Click OnEvent="Button1_Click" /> </AjaxEvents> </ext:Button> <ext:Button ID="Button2" runat="server" Text="Clear Session Values"> <AjaxEvents> <Click OnEvent="Button2_Click" /> </AjaxEvents> </ext:Button> </Buttons> </ext:Panel> <ext:Label ID="Label1" runat="server" Format="Session: {0}" /><br /> <ext:Label ID="Label2" runat="server" Format="Faculty: {0}" /><br /> <ext:Label ID="Label3" runat="server" Format="Department: {0}" /> </form> </body> </html>
I haven't run into any yet with the Session handling. Can you modify the above sample to reproduce the Session issue?
--
Geoffrey McGill
Coolite Inc.
Development Team
Skype : geoffrey.mcgill
Forum Guidelines | Coolite Examples | Coolite API Docs | ExtJS API Docs | Twitter
|
|
|
|