Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
50
WebCombo's not reacting properly to key or mouse
posted

I have a simple form with a WebAsyncRefreshPanel and three webCombo's each reacting to the input of the previous with hidden asp boxes to detect the changes but the movement from Combo to Combo and mouse selections are very spuradic and not reliable, The first ComboBox is great as the InitialiseDataSource function is used to fill the control and everytime any control is used it refills the first combo with the data required for the combo but the second combo fills correctly on the first time leaving the first combo but once a second selection is made in the first combo the problems begin.

The second combo loses it's value and therefore the third can not fill with ts data. I must have something very very worng here but can't see the wood for the trees and time is running out for this project.

PLEASE HELP THIS IS URGENT, THANKS.

Here is my default .aspx :

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>

<%

@ Register assembly="Infragistics35.WebUI.Misc.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.Misc" tagprefix="igmisc" %>

<%

@ Register assembly="Infragistics35.WebUI.WebCombo.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.WebCombo" tagprefix="igcmbo" %>

<%

@ Register assembly="Infragistics35.WebUI.UltraWebGrid.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebGrid" tagprefix="igtbl" %>

<!

 

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></title>

 

 

 

<script type="text/javascript" id="Infragistics">

 

 

/// Service Type combo box changes are detected here

function

 

WcServiceType_BeforeCloseUp(webComboId) {

 

 

 

var combo = igcmbo_getComboById(webComboId);

WcServiceType_EditKeyDown(webComboId, combo.getDisplayValue(), 13);

}

function

 

WcServiceType_EditKeyDown(webComboId,newValue,keyCode){

 

 

 

if (keyCode == 13 || keyCode == 9) {

 

 

var combo = igcmbo_getComboById(webComboId);

 

 

 

if (combo.getDataValue() != null) {

document.getElementById(

'hdServiceTypeRowChanged').value = "1";

 

 

var warp = ig$("warp");

 

 

 

if (!warp)

return;

 

 

var selectedindex = combo.setDisplayValue(newValue, true, false);

warp.refresh();

 

 

var ReferralCentre = igcmbo_getComboById(webComboId);

ReferralCentre.focus();

}

}

 

 

else

document.getElementById(

'hdServiceTypeRowChanged').value = "0";

}

 

/// Referral Centre row changes are detected here

function

 

 

WcReferralCentre_BeforeCloseUp(webComboId) {

 

 

var combo = igcmbo_getComboById(webComboId);

WcReferralCentre_EditKeyDown(webComboId, combo.getDisplayValue(), 13);

}

function

 

 

WcReferralCentre_EditKeyDown(webComboId, newValue, keyCode) {

 

 

if (keyCode == 13 || keyCode == 9) {

 

 

var combo = igcmbo_getComboById(webComboId);

 

 

if (combo.getDataValue() != null) {

document.getElementById(

'hdReferralCentreRowChanged').value = "1";

 

 

var warp = ig$("warp");

 

 

if (!warp)return;

 

 

//var selectedindex = combo.setDisplayValue(newValue, true, false);

combo.setDisplayValue(combo.getDisplayValue());

warp.refresh();

}

}

 

 

else

document.getElementById(

'hdReferralCentreRowChanged').value = "0";

}

 

 

 

 

</

 

script>

 

 

 

</

 

head>

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<div>

 

 

 

</div>

 

 

<igmisc:WebAsyncRefreshPanel ID="warp" runat="server" Height="231px" Width="398px" oncontentrefresh="Page_Load" TriggerPostBackIDs="WcServiceType,WcReferralCentre">

Service Type :

<asp:HiddenField ID="hdServiceTypeRowChanged" runat="server" Value="0" />

 

 

<igcmbo:WebCombo ID="WcServiceType" runat="server" BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" Editable="True" ForeColor="Black" OnInitializeDataSource="WcServiceType_InitializeDataSource" SelBackColor="DarkBlue" SelForeColor="White" Version="4.00" EnableXmlHTTP="True" TabIndex="1">

 

 

<Columns>

 

 

<igtbl:UltraGridColumn>

 

 

<header caption="Column0">

 

 

</header>

 

 

</igtbl:UltraGridColumn>

 

 

</Columns>

 

 

<expandeffects shadowcolor="LightGray"/>

 

 

<dropdownlayout bordercollapse="Separate" rowheightdefault="20px" version="4.00" allowsorting="OnClient" colheadersvisible="No" gridlines="None" headerclickaction="NotSet" xmlloadondemandtype="Accumulative">

 

 

<framestyle backcolor="Silver" borderstyle="Ridge" borderwidth="2px" cursor="Default" font-names="Verdana" font-size="10pt" height="130px" width="325px">

 

 

</framestyle>

 

 

<HeaderStyle BackColor="LightGray" BorderStyle="Solid">

 

 

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />

 

 

</HeaderStyle>

 

 

<RowStyle BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px">

 

 

<borderdetails widthleft="0px" widthtop="0px" />

 

 

</RowStyle>

 

 

<SelectedRowStyle BackColor="DarkBlue" ForeColor="White" />

 

 

</dropdownlayout>

 

 

<ClientSideEvents BeforeCloseUp="WcServiceType_BeforeCloseUp" EditKeyDown="WcServiceType_EditKeyDown" />

 

 

</igcmbo:WebCombo>

Referral Centre :

<asp:HiddenField ID="hdReferralCentreRowChanged" runat="server" Value="0" />

<br/>

 

 

<igcmbo:WebCombo ID="WcReferralCentre" runat="server" BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" ForeColor="Black" SelBackColor="DarkBlue" SelForeColor="White" Version="4.00" Editable="True" TabIndex="2" OnInitializeDataSource="WcReferralCentre_InitializeDataSource">

 

 

<Columns>

 

 

<igtbl:UltraGridColumn>

<header caption="Column0">

 

 

</header>

 

 

</igtbl:UltraGridColumn>

 

 

</Columns>

 

 

<expandeffects shadowcolor="LightGray" />

 

 

<dropdownlayout bordercollapse="Separate" rowheightdefault="20px" version="4.00" allowsorting="OnClient" colheadersvisible="No" gridlines="None" headerclickaction="NotSet" xmlloadondemandtype="Accumulative">

 

 

<framestyle backcolor="Silver" borderstyle="Ridge" borderwidth="2px" cursor="Default" font-names="Verdana" font-size="10pt" height="130px" width="325px">

 

 

</framestyle>

 

 

<HeaderStyle BackColor="LightGray" BorderStyle="Solid">

 

 

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />

 

 

</HeaderStyle>

 

 

<RowStyle BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px">

 

 

<borderdetails widthleft="0px" widthtop="0px"/>

 

 

</RowStyle>

 

 

<SelectedRowStyle BackColor="DarkBlue" ForeColor="White" />

 

 

</dropdownlayout>

 

 

<ClientSideEvents BeforeCloseUp="WcReferralCentre_BeforeCloseUp" EditKeyDown="WcReferralCentre_EditKeyDown" />

 

 

</igcmbo:WebCombo>

 

 

<br />

Referring Consultants :

 

<igcmbo:WebCombo ID="WcReferringConsultant" runat="server" BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" ForeColor="Black" SelBackColor="DarkBlue" SelForeColor="White" Version="4.00" TabIndex="3">

 

 

<Columns>

 

 

<igtbl:UltraGridColumn>

 

 

<header caption="Column0">

 

 

</header>

 

 

</igtbl:UltraGridColumn>

 

 

</Columns>

 

 

<expandeffects shadowcolor="LightGray"/>

 

 

<dropdownlayout bordercollapse="Separate" rowheightdefault="20px" version="4.00">

 

 

<framestyle backcolor="Silver" borderstyle="Ridge" borderwidth="2px" cursor="Default" font-names="Verdana" font-size="10pt" height="130px" width="325px">

 

 

</framestyle>

 

 

<HeaderStyle BackColor="LightGray" BorderStyle="Solid">

 

 

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />

 

 

</HeaderStyle>

 

 

<RowStyle BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px">

 

 

<borderdetails widthleft="0px" widthtop="0px" />

 

 

</RowStyle>

 

 

<SelectedRowStyle BackColor="DarkBlue" ForeColor="White" />

 

 

</dropdownlayout>

 

 

</igcmbo:WebCombo>

 

 

</igmisc:WebAsyncRefreshPanel>

 

 

</form>

</

 

body>

</

 

html>

And here is my Default.aspx.cs :

using

 

System;

using

 

System.Linq;

using

 

System.Web.UI;

using

 

System.Web.UI.WebControls;

using

 

hahcrm.Entities;

//using Infragistics.WebUI.UltraWebToolbar;

using

 

Infragistics.WebUI.WebCombo;

namespace

 

WebApplication2

{

 

public partial class _Default : System.Web.UI.Page

{

 

private Guid gPatId;

 

private Guid gPcrId;

 

public Guid gServiceTypeId;

 

private hahcrmDataContext context = new hahcrmDataContext();

 

protected void Page_Load(object sender, EventArgs e)

{

 

if (hdServiceTypeRowChanged.Value == "1")

{

hdServiceTypeRowChanged.Value =

"0";

WcServiceType_SelectedRowChanged(WcServiceType,

null);

 

return;

}

 

if (hdReferralCentreRowChanged.Value == "1")

{

hdReferralCentreRowChanged.Value =

"0";

WcReferralCentre_SelectedRowChanged(WcReferralCentre,

null);

 

return;

}

 

if (IsPostBack)

 

return;

 

}

 

 

protected void WcServiceType_InitializeDataSource(object sender, WebComboEventArgs e)

{

 

//if (IsPostBack)

 

// return;

 

try

{

 

var allServiceTypes = from a in context.ServiceTypes

 

where a.ShortName != "*Not Selected*"

 

orderby a.ShortName

 

select

 

new

{

a.ServiceTypeID,

a.ShortName

};

WcServiceType.DataValueField =

"ServiceTypeID";

WcServiceType.DataTextField =

"ShortName";

WcServiceType.DataSource = allServiceTypes;

WcServiceType.DataBind();

WcServiceType.Columns[0].Hidden =

true;

 

return;

}

 

catch(Exception)

{

 

string sMessage =

 

"window.alert('There are no Service Types available, please contact IT Services if this error persists.');";

ClientScript.RegisterClientScriptBlock(Page.GetType(),

"ServiceTypeError", sMessage, true);

 

Environment.Exit(0);

}

}

 

/// <summary>

 

/// This is the first selection combo "Service Type", this controls how the rest of the form reacts.

 

/// </summary>

 

/// <param name="listToFill"></param>

 

protected void WcServiceType_SelectedRowChanged(object sender, SelectedRowChangedEventArgs e)

{

 

// catch the empty box error

 

if ((WcServiceType.DataValue == null) || (WcServiceType.DataValue.ToString() == "False"))

{

 

//SetDefaultValues();

WcServiceType.Focus();

 

return;

}

 

try

{

gServiceTypeId=

new Guid(WcServiceType.DataValue.ToString());

 

// service type changed, empty all the other fields for consistency

 

//SetDefaultValues();

 

// fill the referral centre with any relevant values

WcReferralCentre.Enabled =

true;

 

PopulateReferralCentre(gServiceTypeId);

//new Guid(WcServiceType.DataValue.ToString()));

 

// check there is an entry to the Referral Centre drop down

 

if (WcReferralCentre.Rows.Count <= 0)

{

WcReferralCentre.DisplayValue =

"No Referral Centres available, please select another Service Type";

WcReferralCentre.Enabled =

false;

WcServiceType.Focus();

 

return;

}

WcReferralCentre.Focus();

 

return;

}

 

catch(Exception)

{

 

string sMessage =

 

"window.alert('Service Type selected row error.');";

ClientScript.RegisterClientScriptBlock(Page.GetType(),

"ServiceTypeSelectedRowError", sMessage, true);

}

}

 

 

 

 

protected void WcReferralCentre_InitializeDataSource(object sender, WebComboEventArgs e)

{

 

if (IsPostBack)

 

return;

 

if (gServiceTypeId == Guid.Empty)

 

return;

 

try{

 

var allReferralCentres = from org in context.Organisations

 

where org.OrganisationType == 200008 || org.OrganisationType == 200009 || org.OrganisationType == 200010 || org.OrganisationType == 200016 || org.OrganisationType == 200015 || org.OrganisationType == 200014 || org.OrganisationType == 200013 || org.OrganisationType == 200012

 

join fd in context.FunderDirectory on org.AccountID equals fd.FunderID

 

where fd.ServiceTypeID == gServiceTypeId

 

orderby org.OrganisationName

 

select new

{

org.AccountID,

org.OrganisationName,

org.AddressLine1,

org.AddressLine2,

org.AddressLine3,

org.Postcode

};

WcReferralCentre.DataValueField =

"AccountID";

WcReferralCentre.DataTextField =

"OrganisationName".Trim();

WcReferralCentre.DataTextField =

"AddressLine1".Trim();

WcReferralCentre.DataTextField =

"AddressLine2".Trim();

WcReferralCentre.DataTextField =

"AddressLine3".Trim();

WcReferralCentre.DataTextField =

"Postcode".Trim();

WcReferralCentre.DataTextField =

"OrganisationName".Trim();

WcReferralCentre.DataSource = allReferralCentres.ToList();

WcReferralCentre.DataBind();

WcReferralCentre.Columns[0].Hidden =

true;

WcReferralCentre.DropDownLayout.DropdownHeight = 120;

 

if (WcReferralCentre.Rows.Count <= 5)

{

WcReferralCentre.DropDownLayout.DropdownHeight = (24 * WcReferralCentre.Rows.Count) + 24;

 

// display only 5 rows

WcReferralCentre.DropDownLayout.ColWidthDefault = 80;

}

WcReferralCentre.Focus();

 

return;

}

 

catch(Exception)

{

 

string sMessage =

 

"window.alert('There are no Referral Centres available.');";

ClientScript.RegisterClientScriptBlock(Page.GetType(),

"ReferralCentreError", sMessage, true);

}

}

 

 

/// <summary>

 

/// Populates the referal centre based on the selection made in service type

 

/// The Organisation Type is a picklist that is to be narrowed down for selection

 

/// as a Referral Centre, these codes are held in the CRM Organisation.OrganisationType attribute

 

/// </summary>

 

/// <param name="serviceTypeId"></param>

 

private void PopulateReferralCentre(Guid serviceTypeId)

{

 

try

{

 

var allReferralCentres = from org in context.Organisations

 

//where org.OrganisationType == 200008 || org.OrganisationType == 200009 || org.OrganisationType == 200010 || org.OrganisationType == 200016 || org.OrganisationType == 200015 || org.OrganisationType == 200014 || org.OrganisationType == 200013 || org.OrganisationType == 200012

 

join fd in context.FunderDirectory on org.AccountID equals fd.FunderID

 

where fd.ServiceTypeID == gServiceTypeId

 

orderby org.OrganisationName

 

select new

{

org.AccountID,

org.OrganisationName,

org.AddressLine1,

org.AddressLine2,

org.AddressLine3,

org.Postcode

};

WcReferralCentre.DataValueField =

"AccountID";

WcReferralCentre.DataTextField =

"OrganisationName".Trim();

WcReferralCentre.DataTextField =

"AddressLine1".Trim();

WcReferralCentre.DataTextField =

"AddressLine2".Trim();

WcReferralCentre.DataTextField =

"AddressLine3".Trim();

WcReferralCentre.DataTextField =

"Postcode".Trim();

WcReferralCentre.DataTextField =

"OrganisationName".Trim();

WcReferralCentre.DataSource = allReferralCentres.ToList();

WcReferralCentre.DataBind();

WcReferralCentre.Columns[0].Hidden =

true;

WcReferralCentre.DropDownLayout.DropdownHeight = 120;

 

if (WcReferralCentre.Rows.Count <= 5)

{

WcReferralCentre.DropDownLayout.DropdownHeight = (24 * WcReferralCentre.Rows.Count) + 24;

 

// display only 5 rows

WcReferralCentre.DropDownLayout.ColWidthDefault = 80;

}

WcReferralCentre.Focus();

 

return;

}

 

catch(Exception)

{

 

string sMessage =

 

"window.alert('There are no Referral Centres available.');";

ClientScript.RegisterClientScriptBlock(Page.GetType(),

"ReferralCentreError", sMessage, true);

}

 

}

 

 

/// <summary>

 

/// Populates the referring consultant based on the selection made in Referral Centre

 

/// </summary>

 

/// <param name="WcReferralCentreId"></param>

 

private void PopulateReferringConsultant(Guid WcReferralCentreId)

{

 

try

{

 

var allReferringConsultants = from pe in context.ProfessionalsatEstablishments

 

join rc in context.People

 

on pe.ProfessionalID equals rc.PersonID

 

where pe.EstablishmentID == WcReferralCentreId

 

orderby pe.ProfessionalEstablishment

 

select

 

new

{

pe.ProfessionalatEstablishmentID,

pe.ProfessionalEstablishment

};

 

// Bind the retrieved data to the Referring consultant drop down grid

WcReferringConsultant.DataValueField =

"ProfessionalatEstablishmentId";

WcReferringConsultant.DataTextField =

"ProfessionalEstablishment";

WcReferringConsultant.DataSource = allReferringConsultants.ToList();

WcReferringConsultant.DataBind();

WcReferringConsultant.Columns[0].Hidden =

true;

WcReferringConsultant.DropDownLayout.DropdownHeight = 120;

 

if (WcReferringConsultant.Rows.Count <= 5)

WcReferringConsultant.DropDownLayout.DropdownHeight = 24 * WcReferringConsultant.Rows.Count;

 

// display only 5 rows

WcReferringConsultant.Focus();

 

return;

}

 

catch (Exception)

{

 

var ex = new Exception();

 

string sMessage =

 

"window.alert('There are no Referring Consultants at this Establishment, please select another establishment.');";

ClientScript.RegisterClientScriptBlock(Page.GetType(),

"ReferringConsultantError", sMessage, true);

WcReferralCentre.Focus();

 

return;

}

}

 

 

// When the Referral Centre changes the fields for the Funder and Referring Consultant will usually be different

 

// so the screen fields need to reflect the change.

 

protected void WcReferralCentre_SelectedRowChanged(object sender, SelectedRowChangedEventArgs e)

{

 

// catch the empty box error

 

if ((WcReferralCentre.DataValue == null) || (WcReferralCentre.DataValue.ToString() == "False"))

 

return;

 

 

try

{

 

PopulateReferringConsultant(

new Guid(WcReferralCentre.DataValue.ToString()));

 

if (WcReferringConsultant.Rows.Count <= 0)

{

WcReferringConsultant.DisplayValue =

"There are no Referring Consultants at this Referral Centre";

 

return;

}

 

else

{

WcReferringConsultant.Enabled =

true;

}

}

 

catch(Exception)

{

WcReferringConsultant.DisplayValue =

"There are no Referring Consultants at this Referral Centre";

WcReferralCentre.Focus();

 

return;

}

}}}

  • 95
    posted

    I have a somewhat similar problem that got fixed accidentally. I had the "Editable" property of the webcombo originally set to True. I did not wish to allow to type a value only select, so I deleted this attribute. That's when the webcombo stopped refreshing.

    The moment I restored the webcombo attribute, Editable="true", all was well in Infragistics land.

  • 50
    posted

    I would like to thank all concerned for your speedy replies and obvious lack of interest in the issues I am having.