|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 42
|
Hello again, The following has come up, I have a Repeater within a callback panel. so far so good. but within the repeater i call a dialog with a seperaet serverside function, when this function is completed i need to refres the repeater. If i use the following code on serverside i get a javascript error.
Code: C#
ClientScript.RegisterClientScriptBlock(this.GetType(), Guid.NewGuid().ToString(),
"<script language='JavaScript'>eo_Callback('" + cpRepeater.UniqueID + "', '')</script>");
When I create a trigger for the Repeater it works one time.
Code: HTML/ASPX
<eo:CallbackPanel runat="server" ID="cpRepeater" Triggers="{ControlID:repStaff;Parameter:},{ControlID:ddSortFields;Parameter:},{ControlID:btnFirst;Parameter:FirstPage},{ControlID:btnPref;Parameter:PrevPage},{ControlID:btnNext;Parameter:NextPage},{ControlID:btnLast;Parameter:LastPage}"
Width="100%" LoadingHTML="'../../../Lib/Images/progress1.gif'/>" OnExecute="cpRepeater_Execute">
If i use the dialoge option ClientonEnd, it dos nothing
Code: JavaScript
eo_Callback('cpRepeater', '')
tnx,
Patrick Beverloo OfficeSpecialisten www.OfficeSpecialisten.nl
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Patrick, Thanks for posting your question here. As for #1: It will not work. The reason is because RegisterClientScriptBlock renders right after the open tag of the form element, which is always before any of our controls are rendered. Any of our functions only exists after at least one of our control is rendered; As for #2: I am not quite following your question, primarily because I don't quite understand how the repeater, callback panel and dialog interact with each other in your page. If you can provide a little more information on that and we will look into it; As for #3: Please verify if you set ClientSideOnEnd to a function name. You can not set it to a javascript statement. For example, you can set it to "on_dialog_end", and then you have:
Code: JavaScript
function on_dialog_end()
{
eo_Callback('cpRepeater', '');
}
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 42
|
Is ther also a way to execute the callback after the serverside fuction is done.
Patrick Beverloo OfficeSpecialisten www.OfficeSpecialisten.nl
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
What do you mean by "executing the callback after the server side function is done"?
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 42
|
I get a error when i use this and the callback is not fired. [Object expected]
Code: JavaScript
function on_dialog_end()
{
eo_Callback('cpRepeater', '');
}
Patrick Beverloo OfficeSpecialisten www.OfficeSpecialisten.nl
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 42
|
eo_support wrote:What do you mean by "executing the callback after the server side function is done"? Yes.
Patrick Beverloo OfficeSpecialisten www.OfficeSpecialisten.nl
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Patrick,
Can you check your messages? I do not understand what you are asking for.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
This error occurs when you don't have the CallbackPanel control in the page at all. Patrick Beverloo wrote:I get a error when i use this and the callback is not fired. [Object expected]
function on_dialog_end() { eo_Callback('cpRepeater', ''); }
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 42
|
Sorry, I am a dutch man trying to write English.Here is my code. I got a repeater in the first column i show a color (agenda color) this is the status for the employee. Add the end of the row i have a button that shows a dialog so the user can change the color of the agenda. It has a dropdown with a list of status to chose from. Ones the user has selected a color, the user clicks on the save button (also the Accept button). the function that come after this is a server side function SetDates. After is function is done i want to refresh the repeater to show the new color. I hope the code helps a bit. P.S. I have removed some code
Code: HTML/ASPX
<script language="javascript" type="text/javascript" >
function on_dialog_end()
{
eo_Callback('cpRepeater', '');
}
</script>
<asp:HiddenField runat="server" ID="SortFields" Value="Color,CallGroupCode,EmpNr,SurName,ForName,City,ExperienceCode,SexCode,Phone,LastProject" />
<table>
<tr>
<td>
Filter code was here not important
</td>
</tr>
<tr>
<td>
<eo:CallbackPanel runat="server" ID="cpRepeater" Triggers="{ControlID:btnFilter;Parameter:},{ControlID:ddSortFields;Parameter:},{ControlID:btnFirst;Parameter:FirstPage},{ControlID:btnPref;Parameter:PrevPage},{ControlID:btnNext;Parameter:NextPage},{ControlID:btnLast;Parameter:LastPage}"
Width="100%" LoadingHTML="'../../../Lib/Images/progress1.gif'/>" OnExecute="cpRepeater_Execute">
<table runat="server" bgcolor="#6b7dde">
<tr style="border-bottom-color: Transparent;border-top-color: Transparent;border-left-color: Transparent;border-right-color: Transparent;">
<td colspan="6">
<asp:Repeater ID="repEmployee" runat="server" OnItemDataBound="repEmployee_ItemDataBound">
<HeaderTemplate>
<table width="100%" bgcolor="#FFFFFF" style="border: none;">
<tr bgcolor="#6b7dde" style="color: #FFFFFF; border: none;" height="15px">
<td>
<%# GetLabel("Agenda")%>
</td>
<td>
<%# GetLabel("CallGroupCode")%>
</td>
<td>
<%# GetLabel("EmpNr")%>
</td>
<td>
<%# GetLabel("SurName")%>
</td>
<td>
<%# GetLabel("ForName")%>
</td>
<td>
<%# GetLabel("City")%>
</td>
<td>
<%# GetLabel("ExperienceCode")%>
</td>
<td>
<%# GetLabel("SexCode")%>
</td>
<td>
<%# GetLabel("Phone")%>
</td>
<td>
<%# GetLabel("LastProject")%>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#E7FBFA" style="color: #000000;" onmouseover="this.originalcolor=this.style.backgroundColor; this.style.backgroundColor='#6b7dde';"
onmouseout="this.style.backgroundColor=this.originalcolor;">
<td>
<asp:Label ID="lblColor" runat="server" Text=" " BackColor='<%#System.Drawing.Color.FromName(DataBinder.Eval(Container.DataItem, "Color").ToString()) %>'
SkinID="None" BorderColor="#000000" BorderStyle="Dotted" BorderWidth="1"></asp:Label>
<div id="tooltip" style="filter: alpha(opacity=95); background-color: white; position: absolute;
visibility: hidden; z-index: 2; font: normal 8pt sans-serif; padding: 3px; border: solid 1px;"
runat="server">
<asp:Label ID="lblToolTip" runat="server" SkinID="None" Text='<%#DataBinder.Eval(Container.DataItem, "ColorDesc")%>'></asp:Label>
</div>
</td>
<td nowrap>
<asp:HiddenField runat="server" ID="HumanResourceId" Value='<%# DataBinder.Eval(Container.DataItem, "HumanResourceId")%>' />
<%# DataBinder.Eval(Container.DataItem, "CallGroupCode")%>
</td>
<td nowrap>
<asp:Label ID="txtEmpNr" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "EmpNr")%>'></asp:Label>
</td>
<td nowrap>
<asp:Label ID="txtSurName" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "SurName")%>'></asp:Label>
</td>
<td nowrap>
<asp:Label ID="txtForName" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "ForName")%>'></asp:Label>
</td>
<td nowrap>
<%# DataBinder.Eval(Container.DataItem, "City")%>
</td>
<td nowrap>
<%# DataBinder.Eval(Container.DataItem, "ExperienceCode")%>
</td>
<td nowrap>
<%# DataBinder.Eval(Container.DataItem, "SexCode")%>
</td>
<td nowrap>
<asp:Label ID="txtPhone" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "Phone")%>'></asp:Label>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "LastProject")%>
</td>
<td>
<asp:Image ID="btnSMS" runat="server" ToolTip='<%# GetLabel("btnSMS")%>' ImageUrl="~/Lib/Icons/Gridview/SMS.gif" /></td>
<td>
<asp:Image ID="btnBook" runat="server" ToolTip='<%# GetLabel("btnBook")%>' ImageUrl="~/Lib/Images/24x24/Project.gif"
/></td>
<td>
<eo:Dialog ID="dlAgenda" runat="server" Width="300px" ShowButton="btnAgenda" AllowResize="True"
BorderColor="#335C88" BorderStyle="Solid" BorderWidth="1px" CloseButtonUrl="00070101"
ControlSkinID="None" HeaderHtml="Dialog Title" MinimizeButtonUrl="00070102" ResizeImageUrl="00020014"
RestoreButtonUrl="00070103" ShadowColor="LightGray" ShadowDepth="3" AcceptButton="btnSave"
CancelButton="btnCancel" BackShadeColor="DimGray" AcceptButtonPostBack="True" ClientSideOnEnd="on_dialog_end()">
<HeaderStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 11px; background-image: url(00070104); padding-bottom: 3px; padding-top: 3px; font-family: tahoma" />
<FooterStyleActive CssText="background-color: #e5f1fd; padding-bottom: 8px;" />
<ContentStyleActive CssText="border-top: #335c88 1px solid; background-color: #e5f1fd" />
<ContentTemplate>
<table>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblEmpNr" runat="server" Text="lblEmpNr"></asp:Label>
</td>
<td class="TextInfo">
<asp:Label ID="txtEmpNr" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblSurName" runat="server" Text="lblSurName"></asp:Label>
</td>
<td class="TextInfo">
<asp:Label ID="txtSurName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblForName" runat="server" Text="lblForName"></asp:Label>
</td>
<td class="TextInfo">
<asp:Label ID="txtForName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblAgendaType" runat="server" Text="lblAgendaType"></asp:Label>
</td>
<td class="TextInfo">
<asp:DropDownList ID="ddAgendaType" runat="server" >
</asp:DropDownList>
</td>
</tr>
</table>
<asp:HiddenField runat="server" ID="HRId" />
</ContentTemplate>
<FooterTemplate>
<div style="text-align: right;">
<asp:ImageButton ID="btnSave" runat="server" CausesValidation="false" OnClick="SetDates"
ImageUrl="~/Lib/Icons/24x24/disk_blue.gif" />
<asp:ImageButton ID="btnCancel" runat="server" CausesValidation="false" ImageUrl="~/Lib/Icons/24x24/error.gif" />
</div>
</FooterTemplate>
<ShowEffect Type="GlideTopLeftToBottomRight" />
<CloseEffect Type="GlideBottomRightToTopLeft" />
</eo:Dialog>
<asp:ImageButton ID="btnAgenda" runat="server" ToolTip='<%# GetLabel("btnAgenda")%>'
ImageUrl="~/Lib/Icons/Gridview/TimeFrame.gif" /></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="color: #000000;" onmouseover="this.originalcolor=this.style.backgroundColor; this.style.backgroundColor='#6b7dde';"
onmouseout="this.style.backgroundColor=this.originalcolor;">
<td>
<asp:Label ID="lblColor" runat="server" Text=" " BackColor='<%#System.Drawing.Color.FromName(DataBinder.Eval(Container.DataItem, "Color").ToString()) %>'
SkinID="None" BorderColor="#000000" BorderStyle="Dotted" BorderWidth="1"></asp:Label>
<div id="tooltip" style="filter: alpha(opacity=95); background-color: white; position: absolute;
visibility: hidden; z-index: 2; font: normal 8pt sans-serif; padding: 3px; border: solid 1px;"
runat="server">
<asp:Label ID="lblToolTip" runat="server" SkinID="None" Text='<%#DataBinder.Eval(Container.DataItem, "ColorDesc")%>'></asp:Label>
</div>
</td>
<td nowrap>
<asp:HiddenField runat="server" ID="HumanResourceId" Value='<%# DataBinder.Eval(Container.DataItem, "HumanResourceId")%>' />
<%# DataBinder.Eval(Container.DataItem, "CallGroupCode")%>
</td>
<td nowrap>
<asp:Label ID="txtEmpNr" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "EmpNr")%>'></asp:Label>
</td>
<td nowrap>
<asp:Label ID="txtSurName" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "SurName")%>'></asp:Label>
</td>
<td nowrap>
<asp:Label ID="txtForName" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "ForName")%>'></asp:Label>
</td>
<td nowrap>
<%# DataBinder.Eval(Container.DataItem, "City")%>
</td>
<td nowrap>
<%# DataBinder.Eval(Container.DataItem, "ExperienceCode")%>
</td>
<td nowrap>
<%# DataBinder.Eval(Container.DataItem, "SexCode")%>
</td>
<td nowrap>
<asp:Label ID="txtPhone" runat="server" SkinID="None" Text='<%# DataBinder.Eval(Container.DataItem, "Phone")%>'></asp:Label>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "LastProject")%>
</td>
<td>
<asp:Image ID="btnSMS" runat="server" ToolTip='<%# GetLabel("btnSMS")%>' ImageUrl="~/Lib/Icons/Gridview/SMS.gif" /></td>
<td>
<asp:Image ID="btnBook" runat="server" ToolTip='<%# GetLabel("btnBook")%>' ImageUrl="~/Lib/Images/24x24/Project.gif"
/></td>
<td>
<eo:Dialog ID="dlAgenda" runat="server" Width="300px" ShowButton="btnAgenda" AllowResize="True"
BorderColor="#335C88" BorderStyle="Solid" BorderWidth="1px" CloseButtonUrl="00070101"
ControlSkinID="None" HeaderHtml="Dialog Title" MinimizeButtonUrl="00070102" ResizeImageUrl="00020014"
RestoreButtonUrl="00070103" ShadowColor="LightGray" ShadowDepth="3" AcceptButton="btnSave"
CancelButton="btnCancel" BackShadeColor="DimGray" AcceptButtonPostBack="True" ClientSideOnEnd="on_dialog_end()">
<HeaderStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 11px; background-image: url(00070104); padding-bottom: 3px; padding-top: 3px; font-family: tahoma" />
<FooterStyleActive CssText="background-color: #e5f1fd; padding-bottom: 8px;" />
<ContentStyleActive CssText="border-top: #335c88 1px solid; background-color: #e5f1fd" />
<ContentTemplate>
<table>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblEmpNr" runat="server" Text="lblEmpNr"></asp:Label>
</td>
<td class="TextInfo">
<asp:Label ID="txtEmpNr" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblSurName" runat="server" Text="lblSurName"></asp:Label>
</td>
<td class="TextInfo">
<asp:Label ID="txtSurName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblForName" runat="server" Text="lblForName"></asp:Label>
</td>
<td class="TextInfo">
<asp:Label ID="txtForName" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="LabelInfo">
<asp:Label ID="lblAgendaType" runat="server" Text="lblAgendaType"></asp:Label>
</td>
<td class="TextInfo">
<asp:DropDownList ID="ddAgendaType" runat="server">
</asp:DropDownList>
</td>
</tr>
</table>
<asp:HiddenField runat="server" ID="HRId" />
</ContentTemplate>
<FooterTemplate>
<div style="text-align: right;">
<asp:ImageButton ID="btnSave" runat="server" CausesValidation="false" OnClick="SetDates"
ImageUrl="~/Lib/Icons/24x24/disk_blue.gif" />
<asp:ImageButton ID="btnCancel" runat="server" CausesValidation="false" ImageUrl="~/Lib/Icons/24x24/error.gif" />
</div>
</FooterTemplate>
<ShowEffect Type="GlideTopLeftToBottomRight" />
<CloseEffect Type="GlideBottomRightToTopLeft" />
</eo:Dialog>
<asp:ImageButton ID="btnAgenda" runat="server" ToolTip='<%# GetLabel("btnAgenda")%>'
ImageUrl="~/Lib/Icons/Gridview/TimeFrame.gif" /></td>
</tr>
</AlternatingItemTemplate>
<FooterTemplate>
<tr bgcolor="#6b7dde" style="color: #FFFFFF; border: none;" height="15px">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</eo:CallbackPanel>
</td>
</tr>
</table>
Code: C#
/// <summary>
/// Get Employee list during CallBack
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void cpRepeater_Execute(object sender, EO.Web.CallbackEventArgs e)
{
if (txtDate.SelectedDate == null || txtDate.SelectedDate == DateTime.MinValue
|| ddDepartmentCode.SelectedIndex <= 0)
return;
int PageIndex = 0;
CallCenter.Date = txtDate.SelectedDate;
CallCenter.DepartmentId = new Guid(ddDepartmentCode.SelectedValue);
CallCenter.AgendaTypeId = new Guid(ddAgendaStatus.SelectedValue);
CallCenter.CallGroup = ddACallgroup.SelectedIndex > 0 ? "%" + ddACallgroup.SelectedItem.Value + "%" : null;
CallCenter.EmpNr = string.IsNullOrEmpty(txtAStafNumber.Text) ? null : "%" + txtAStafNumber.Text + "%";
CallCenter.SurName = string.IsNullOrEmpty(txtASurName.Text) ? null : "%" + txtASurName.Text + "%";
CallCenter.City = string.IsNullOrEmpty(txtACity.Text) ? null : "%" + txtACity.Text + "%";
CallCenter.ExperienceCode = string.IsNullOrEmpty(txtAExperience.Text) ? null : "%" + txtAExperience.Text + "%";
CallCenter.SexCode = string.IsNullOrEmpty(txtASexCode.Text) ? null : "%" + txtASexCode.Text + "%";
string strPostback =
ddACallgroup.SelectedIndex.ToString() + "|" +
txtAStafNumber.Text.ToString() + "|" +
txtASurName.Text.ToString() + "|" +
txtACity.Text.ToString() + "|" +
txtAExperience.Text.ToString() + "|" +
txtASexCode.Text.ToString() + "|" +
txtDate.SelectedDate.ToString() +
ddDepartmentCode.SelectedIndex.ToString();
Session.Add("strPostback", strPostback);
repEmployee.DataSource = pd;
repEmployee.DataBind();
}
/// <summary>
/// Set agenda Date and execute CallBack panel (Reload repeater)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void SetDates(object sender, EventArgs e)
{
EO.Web.Dialog dlAgenda = (EO.Web.Dialog)(((System.Web.UI.WebControls.ImageButton)(sender)).Parent.Parent);
HiddenField dlAgendaHRId = (HiddenField)dlAgenda.ContentContainer.FindControl("HRId");
DropDownList dlAgendaddAgendaType = (DropDownList)dlAgenda.ContentContainer.FindControl("ddAgendaType");
if (dlAgendaddAgendaType.SelectedIndex >= 0)
{
//Agenda Update
Agenda.HumanResourceId = new Guid(dlAgendaHRId.Value);
Agenda.AgendaTypeId = new Guid(dlAgendaddAgendaType.SelectedValue);
Agenda.AgendaDate = txtDate.SelectedDate;
int ErrorCode;
if (new Guid(dlAgendaddAgendaType.SelectedValue) == Guid.Empty)
Agenda.Delete(out ErrorCode);
else
Agenda.Update(out ErrorCode);
if (ErrorCode != 0)
DisplayAlert("CantUpdate_" + ErrorCode);
// Execute CallBack???
}
}
Patrick Beverloo OfficeSpecialisten www.OfficeSpecialisten.nl
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Patrick,
The code definitely helps. We will look into it and get back to you as soon as possible.
Thanks
|
|