Hi, I'm facing a really weird problem and I need some help. Here's what I'm trying to do: I have a main page containing user controls. On my main page, when I click a button I display the content of one of my user control that contains a king of popup window with a combobox in it (combo box populated by a call to a distant server). Until then everything works fine. In this same popup, I have a button that is once clicked, a call to a web service is done so I retrieve the selected item in the combobox and I do some operations on it. Again, until then everything's fine.
The problem is that after the call to the server, the combo box stops working. I do not reload the page, I use a RadAjaxManager in my main page to manage what is supposed to be updated in the page, so the main page and the user controls are not reloaded after the server call. My popup window remains displayed and absolutely nothing happens when I click on the combobox. I tried to use the ComboBox from RadControls for ASP.NET (not Prometheus), and it seems to be working. The problem is that I cannot use it because of a bug with safari (reported by mathieu last monday).
Here's some code example to help understand the problem:
MainPage.aspx
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Bidon</title>
<link rel="stylesheet" type="text/css" href="css/main.css" media="all" />
<link rel="stylesheet" type="text/css" href="css/input.css" media="all" />
<link rel="stylesheet" type="text/css" href="Prometheus/Vista/ComboBox.Vista.css" />
<script src="js/input.js" type="text/javascript"></script>
<script src="js/validation.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<radA:RadAjaxManager ID="RadAjaxManager1" runat="server">
</radA:RadAjaxManager>
<div>
<button id="Button1" onclick="document.getElementById('healthQuestionnaire_mhContainer').style.display='block'; return false;" >Button</button>
<div id="divHQ" runat="server" ><questionnaire id="healthQuestionnaire" runat="server"></questionnaire></div>
</div>
</form>
</body>
</html>
MainPage.aspx.cs (I initilialize the radajaxmanager dynamicaly)
protected void Page_Load(object sender, EventArgs e)
{
//Get the WebUserControl
UserControl MyControl = (UserControl)Page.FindControl("healthQuestionnaire");
//Get user control's button and label
Button MyButton = (Button)MyControl.FindControl("btnOk");
HtmlGenericControl MyDiv = (HtmlGenericControl)MyControl.FindControl("mhContainer");
//Add the necessary AJAX setting programmatically
RadAjaxManager1.AjaxSettings.AddAjaxSetting(MyButton, MyDiv);
}
UserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="healthQuestionnaire.ascx.cs" Inherits="doctorPhone.signup.healthQuestionnaire" %>
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="mhContainer" runat="server" class="entireErrMsg" style="display: none;" >
<div id="mhBox" runat="server" class="errorMsgBox" style="height: 150px;">
<img src="images/messageBox/CornerLeft.png" alt="img" />
<div runat="server" id="mhTitleBar" class="msgBorderTop" ></div>
<img src="images/messageBox/CornerRight.png" alt="img" />
<div class="msgBorderLeft" ></div>
<div class="msgBoxContentArea" >
<table style="width: 100%; height: 100%;">
<tr>
<td style="width: 25%;">
<div class="text13_383838" style="float: right; margin-top: 15px;">Condition</div>
</td>
<td style="width: 75%;" >
<div style="float: right; margin-top:15px;">
<img style="margin-left:10px;" src="Prometheus/Vista/ComboBox/dropBoxLeftOFF.gif" id="imgPatientConditions_Input" />
<telerik:RadComboBox Width="239px" EnableEmbeddedSkins="False" Skin="Vista" ID="patientConditions"
runat="server" DataTextField="name" DataValueField="code" EnableLoadOnDemand="true" MarkFirstMatch="True" OnItemsRequested="patientConditions_ItemsRequested" >
<CollapseAnimation Duration="200" Type="OutQuint" />
<ExpandAnimation Type="OutQuart" />
</telerik:RadComboBox>
</div>
</td>
</tr>
<tr style="height: 40px;">
<td colspan="2" style="width: 395px; height: 40px; vertical-align:middle;" >
<div style="float: right;">
<div style="padding-right: 8px;" onmousedown="dpButtonMouseDown('btnCancelLeft','btnCancel','btnCancelRight')" onmouseup="dpButtonMouseUp('btnCancelLeft','btnCancel','btnCancelRight')" onmouseout="dpButtonMouseUp('btnCancelLeft','btnCancel','btnCancelRight')">
<img id="btnCancelLeft" src="images/buttons/btnLeftUp.png" alt="img" />
<button id="btnCancel" onclick="document.getElementById('healthQuestionnaire_mhContainer').style.display='none'; return false;" class="dpButton">Cancel</button>
<img id="btnCancelRight" src="images/buttons/btnRightUp.png" alt="img" />
</div>
<div onmousedown="dpButtonMouseDown('healthQuestionnaire_btnOkLeft','healthQuestionnaire_btnOk','healthQuestionnaire_btnOkRight')" onmouseup="dpButtonMouseUp('healthQuestionnaire_btnOkLeft','healthQuestionnaire_btnOk','healthQuestionnaire_btnOkRight')" onmouseout="dpButtonMouseUp('healthQuestionnaire_btnOkLeft','healthQuestionnaire_btnOk','healthQuestionnaire_btnOkRight')">
<img id="healthQuestionnaire_btnOkLeft" src="images/buttons/btnLeftUp.png" alt="img" />
<asp:Button id="btnOk" runat="server" CssClass="dpButton" Text="OK" OnClick="btnOk_Click" ></asp:Button>
<img id="healthQuestionnaire_btnOkRight" src="images/buttons/btnRightUp.png" alt="img" />
</div>
</div>
</td>
</tr>
</table>
</div>
<div class="msgBorderRight" ></div>
<img src="images/messageBox/FooterLeft.png" alt="img" />
<div class="msgBorderBottom" ></div>
<img src="images/messageBox/FooterRight.png" alt="img" />
</div>
</div>
UserControl.ascx.cs
public partial class healthQuestionnaire : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
conditionDTO[] dtos = searchConditions(null);
//Bind to datagrid
patientConditions.DataSource = dtos;
patientConditions.DataBind();
}
public conditionDTO[] searchConditions(String searchCriteria)
{
//Bind to webservice
HealthServiceWS myService = new HealthServiceWS();
conditionDTO[] dtos = myService.getConditions(new appSessionDTO(), searchCriteria);
return dtos;
}
protected void patientConditions_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
RadComboBox combo = (RadComboBox)o;
combo.Items.Clear();
conditionDTO[] dtos = searchConditions(e.Text);
foreach (conditionDTO dto in dtos)
{
RadComboBoxItem item = new RadComboBoxItem(dto.name);
item.Value = dto.code.ToString();
combo.Items.Add(item);
}
}
protected void btnOk_Click(object sender, EventArgs e)
{
HttpCookie authCookie = Request.Cookies[CookieAttributes.COOKIE_NAME];
HealthServiceWS myService = new HealthServiceWS();
patientConditionDTO patientCondition = new patientConditionDTO();
patientCondition.patientId = Int32.Parse(authCookie.Values.Get(CookieAttributes.ATT_PATIENT_ID));
patientCondition.conditionId = Int32.Parse(patientConditions.SelectedItem.Value);
myService.addPatientCondition(new appSessionDTO(), patientCondition);
mhContainer.Style["display"] = "block";
}
}
Thx for the help
Phil
The problem is that after the call to the server, the combo box stops working. I do not reload the page, I use a RadAjaxManager in my main page to manage what is supposed to be updated in the page, so the main page and the user controls are not reloaded after the server call. My popup window remains displayed and absolutely nothing happens when I click on the combobox. I tried to use the ComboBox from RadControls for ASP.NET (not Prometheus), and it seems to be working. The problem is that I cannot use it because of a bug with safari (reported by mathieu last monday).
Here's some code example to help understand the problem:
MainPage.aspx
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Bidon</title>
<link rel="stylesheet" type="text/css" href="css/main.css" media="all" />
<link rel="stylesheet" type="text/css" href="css/input.css" media="all" />
<link rel="stylesheet" type="text/css" href="Prometheus/Vista/ComboBox.Vista.css" />
<script src="js/input.js" type="text/javascript"></script>
<script src="js/validation.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<radA:RadAjaxManager ID="RadAjaxManager1" runat="server">
</radA:RadAjaxManager>
<div>
<button id="Button1" onclick="document.getElementById('healthQuestionnaire_mhContainer').style.display='block'; return false;" >Button</button>
<div id="divHQ" runat="server" ><questionnaire id="healthQuestionnaire" runat="server"></questionnaire></div>
</div>
</form>
</body>
</html>
MainPage.aspx.cs (I initilialize the radajaxmanager dynamicaly)
protected void Page_Load(object sender, EventArgs e)
{
//Get the WebUserControl
UserControl MyControl = (UserControl)Page.FindControl("healthQuestionnaire");
//Get user control's button and label
Button MyButton = (Button)MyControl.FindControl("btnOk");
HtmlGenericControl MyDiv = (HtmlGenericControl)MyControl.FindControl("mhContainer");
//Add the necessary AJAX setting programmatically
RadAjaxManager1.AjaxSettings.AddAjaxSetting(MyButton, MyDiv);
}
UserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="healthQuestionnaire.ascx.cs" Inherits="doctorPhone.signup.healthQuestionnaire" %>
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="radG" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="mhContainer" runat="server" class="entireErrMsg" style="display: none;" >
<div id="mhBox" runat="server" class="errorMsgBox" style="height: 150px;">
<img src="images/messageBox/CornerLeft.png" alt="img" />
<div runat="server" id="mhTitleBar" class="msgBorderTop" ></div>
<img src="images/messageBox/CornerRight.png" alt="img" />
<div class="msgBorderLeft" ></div>
<div class="msgBoxContentArea" >
<table style="width: 100%; height: 100%;">
<tr>
<td style="width: 25%;">
<div class="text13_383838" style="float: right; margin-top: 15px;">Condition</div>
</td>
<td style="width: 75%;" >
<div style="float: right; margin-top:15px;">
<img style="margin-left:10px;" src="Prometheus/Vista/ComboBox/dropBoxLeftOFF.gif" id="imgPatientConditions_Input" />
<telerik:RadComboBox Width="239px" EnableEmbeddedSkins="False" Skin="Vista" ID="patientConditions"
runat="server" DataTextField="name" DataValueField="code" EnableLoadOnDemand="true" MarkFirstMatch="True" OnItemsRequested="patientConditions_ItemsRequested" >
<CollapseAnimation Duration="200" Type="OutQuint" />
<ExpandAnimation Type="OutQuart" />
</telerik:RadComboBox>
</div>
</td>
</tr>
<tr style="height: 40px;">
<td colspan="2" style="width: 395px; height: 40px; vertical-align:middle;" >
<div style="float: right;">
<div style="padding-right: 8px;" onmousedown="dpButtonMouseDown('btnCancelLeft','btnCancel','btnCancelRight')" onmouseup="dpButtonMouseUp('btnCancelLeft','btnCancel','btnCancelRight')" onmouseout="dpButtonMouseUp('btnCancelLeft','btnCancel','btnCancelRight')">
<img id="btnCancelLeft" src="images/buttons/btnLeftUp.png" alt="img" />
<button id="btnCancel" onclick="document.getElementById('healthQuestionnaire_mhContainer').style.display='none'; return false;" class="dpButton">Cancel</button>
<img id="btnCancelRight" src="images/buttons/btnRightUp.png" alt="img" />
</div>
<div onmousedown="dpButtonMouseDown('healthQuestionnaire_btnOkLeft','healthQuestionnaire_btnOk','healthQuestionnaire_btnOkRight')" onmouseup="dpButtonMouseUp('healthQuestionnaire_btnOkLeft','healthQuestionnaire_btnOk','healthQuestionnaire_btnOkRight')" onmouseout="dpButtonMouseUp('healthQuestionnaire_btnOkLeft','healthQuestionnaire_btnOk','healthQuestionnaire_btnOkRight')">
<img id="healthQuestionnaire_btnOkLeft" src="images/buttons/btnLeftUp.png" alt="img" />
<asp:Button id="btnOk" runat="server" CssClass="dpButton" Text="OK" OnClick="btnOk_Click" ></asp:Button>
<img id="healthQuestionnaire_btnOkRight" src="images/buttons/btnRightUp.png" alt="img" />
</div>
</div>
</td>
</tr>
</table>
</div>
<div class="msgBorderRight" ></div>
<img src="images/messageBox/FooterLeft.png" alt="img" />
<div class="msgBorderBottom" ></div>
<img src="images/messageBox/FooterRight.png" alt="img" />
</div>
</div>
UserControl.ascx.cs
public partial class healthQuestionnaire : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
conditionDTO[] dtos = searchConditions(null);
//Bind to datagrid
patientConditions.DataSource = dtos;
patientConditions.DataBind();
}
public conditionDTO[] searchConditions(String searchCriteria)
{
//Bind to webservice
HealthServiceWS myService = new HealthServiceWS();
conditionDTO[] dtos = myService.getConditions(new appSessionDTO(), searchCriteria);
return dtos;
}
protected void patientConditions_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
RadComboBox combo = (RadComboBox)o;
combo.Items.Clear();
conditionDTO[] dtos = searchConditions(e.Text);
foreach (conditionDTO dto in dtos)
{
RadComboBoxItem item = new RadComboBoxItem(dto.name);
item.Value = dto.code.ToString();
combo.Items.Add(item);
}
}
protected void btnOk_Click(object sender, EventArgs e)
{
HttpCookie authCookie = Request.Cookies[CookieAttributes.COOKIE_NAME];
HealthServiceWS myService = new HealthServiceWS();
patientConditionDTO patientCondition = new patientConditionDTO();
patientCondition.patientId = Int32.Parse(authCookie.Values.Get(CookieAttributes.ATT_PATIENT_ID));
patientCondition.conditionId = Int32.Parse(patientConditions.SelectedItem.Value);
myService.addPatientCondition(new appSessionDTO(), patientCondition);
mhContainer.Style["display"] = "block";
}
}
Thx for the help
Phil