protected void rgdEthnicityReport_PdfExporting(object sender, Telerik.Web.UI.GridPdfExportingArgs e)
{
if (isPdfExport)
{
GeneratePdfDocument(e.RawHTML);
}
else
{
Session["HTMLContent"] = e.RawHTML;
}
}
private void GeneratePdfDocument(string htmlContent)
{
try
{
this.PDF = new Doc();
PDF.Rect.Inset(10, 50);
this.PDF.HtmlOptions.Timeout = 600000;
this.PDF.HtmlOptions.RetryCount = 2;
int pdfID;
PDF.TopDown = true;
pdfID = this.PDF.AddImageHtml(htmlContent);
while (true)
{
if (this.PDF.Chainable(pdfID) == false)
break;
this.PDF.Page = PDF.AddPage();
pdfID = this.PDF.AddImageToChain(pdfID);
}
object pdfObject = this.PDF.GetData();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + "Ethnicity Summary Report" + ".pdf");
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.BinaryWrite((byte[])pdfObject);
this.PDF.Clear();
HttpContext.Current.Response.End();
}
catch (EHRExceptions ex)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);
Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());
}
}
protected void rbtnSendMail_Click(object sender, EventArgs e)
{
if (NeedRedirection || WasSessionEnd()) return;
try
{
isPdfExport = false;
this.rgdEthnicityReport.MasterTableView.ExportToPdf();
string Intext = "false";
string letterName = "Ethnicity Summary Report";
RadWindow1.NavigateUrl = "~/Patient/Management/ReportEmailing.aspx";
RadWindow1.NavigateUrl += "?InText=" + Intext + "&LetterName=" + letterName + "&EmailCategory=Report";
RadWindow1.Title = "Ethnicity Summary Report";
RadWindow1.Visible = true;
RadWindow1.VisibleOnPageLoad = true;
}
catch (EHRExceptions ex)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);
Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());
}
}
this.rgdEthnicityReport.MasterTableView.ExportToPdf(); so that pdfexporting event is called and we get RawHtml in the session (due to isPDFExport set to false. I have issue over here, It is not showing our Window for sending email & showing the pdf exported by telerik. I want to suppress this & getonly RawHtml & then execute our code for sending email by showing radwindow. We also tried moving code from send email to pdfexporting block but same issue.
Please suggest how to achieve this.
Thanks.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DashBoard.aspx.cs" Inherits="DashBoard_DashBoard" EnableEventValidation="false"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE HTML />
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
link
href
=
"../css/main.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
<
link
href
=
"../css/jquery-ui.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
<
script
src
=
"../Scripts/jquery.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/jquery-ui.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/jquery.ui.core.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"../Scripts/jquery-ui-1.8.5.custom.min.js"
type
=
"text/javascript"
></
script
>
<
title
>Dashboard</
title
>
<
style
type
=
"text/css"
>
.style1
{
width: 119%;
height: 324px;
}
.style3
{
width: 265px;
height: 284px;
}
</
style
>
<%-- Css for maximize and minimize button--%>
<
style
type
=
"text/css"
>
.max
{
/*change the url of the image */
width: 20px !important;
background: url('../images/maximize.gif') no-repeat !important;
}
.min
{
/*change the url of the image */
width: 20px !important;
background: url('../images/minimize.jpg') no-repeat !important;
}
.style5
{
width: 265px;
height: 182px;
}
.style6
{
width: 265px;
height: 181px;
}
</
style
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var isMaxmized = false;
var dockMax = false;
var dockZone;
var sessionValue = '<%= Session["event"] %>';
if (sessionValue == "sorting")
{
isMaxmized = true;
var dockMax = true;
}
function dockInitialize(obj, args) {
OverrideClose();
}
// When a dock is closed, its DockZoneId is stored into the hidden field
function ClientCommand(sender, args)
{
if (args.Command.get_name() == "Close")
{
var hiddenField = $get("<%= closedDockZoneId.ClientID %>");
hiddenField.value = sender.get_dockZoneID();
isMaxmized = false;
}
}
//When the content area of a dock is clicked, page navigation to the desired location must take place
function Dock_OnClientInitialize(dock, args) {
var dockElem = dock.get_contentContainer(); //get reference to the dock's wrapper element
$addHandler(dockElem, "click", function () {
if (isMaxmized) {
return;
}
switch (dock.get_title())//assign different pages to the docks according their title
{
case "Alarm Summary":
window.location = "AlarmSummary.aspx";
break;
case "Active Calls":
window.location = "ActiveCalls.aspx";
break;
case "Pending Calls":
window.location = "PendingCalls.aspx";
break;
case "Call Activity for Active Consoles":
window.location = "CallActivityForConole.aspx";
break;
case "Call Activity for Active Dispatchers":
window.location = "CallActivityForDispatchr.aspx";
break;
case "Call Activity for Active Endpoints":
window.location = "CallActivityForEndPnt.aspx";
break;
}
}, false);
}
function Dock_resize(dock, args) {
args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
}
function noError() {
return true;
}
window.onerror = noError;
//Function for providng maximize and minimize features for the docks
var dockZoneID = "";
var dockInitialSize = {};
function Dock_OnMaximizeCommand(dock, args) {
if (window.innerHeight != undefined) {
var viewportSize = { 'width': window.innerWidth + "px", 'height': window.innerHeight + "px" };
//var viewportSize = { 'width': 750, 'height': 550 };
}
else
var viewportSize = { 'width': document.documentElement.clientWidth + "px", 'height': document.documentElement.clientHeight + "px" };
//var viewportSize = { 'width': 750, 'height': 550 };
if (dockMax==false) {
//primary state
dockZoneID = dock.get_dockZoneID(); //store the dockZone where the dock was docked
dock.undock();
//set absolute position manually to workaround a bug in the undock() method
dock.get_element().style.position = "absolute";
//position the dock according to the layout wrapper
dock.set_top("0px");
dock.set_left("0px");
//store original dock size
dockInitialSize.width = dock.get_element().clientWidth;
dockInitialSize.height = dock.get_element().clientHeight;
//maximize the dock
dock.set_width(viewportSize.width);
dock.set_height(viewportSize.height);
//set the state of the command
args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
isMaxmized = true;
dockMax = true;
// command.set_state(1);
}
else {
//alternate state
//restore original dock size
if (dockInitialSize.width != undefined && dockInitialSize.height != undefined) {
dock.set_width(dockInitialSize.width);
dock.set_height(dockInitialSize.height);
}
else
{
dock.set_width(300);
dock.set_height(175);
}
if (dockZoneID == "")
{
var zoneid =dock.get_title()
$find("RadDockZone1").dock(dock);
}
else
{
$find(dockZoneID).dock(dock);
}
//dock the dock to its zone
//set the state of the command
args.Command.set_state(args.Command.get_state() == 1 ? 2 : 1);
isMaxmized = false;
dockMax = false;
//command.set_state(2);
}
}
</
script
>
<
style
id
=
"dockStyles"
type
=
"text/css"
runat
=
"server"
>
</
style
>
</
telerik:RadCodeBlock
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
visible
=
"True"
>
<
input
id
=
"lnkPopup"
type
=
"button"
class
=
"btnVeryBig"
value
=
""
title
=
"Add Widget"
/>
<
div
id
=
"modalRightCenterContent"
style
=
"display: none; background-color:white; border-color:red; border-style:solid; border-width:1px;"
>
<
div
class
=
"contentTableHeading"
>
<
asp:CheckBox
ID
=
"chkAlrmSumry"
runat
=
"server"
/>
<
asp:Label
ID
=
"alrmSuryLbl"
runat
=
"server"
Text
=
"Alarm Summary"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkActCals"
runat
=
"server"
/>
<
asp:Label
ID
=
"actCalLbl"
runat
=
"server"
Text
=
"Active Calls"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkPndCals"
runat
=
"server"
/>
<
asp:Label
ID
=
"pndCalLbl"
runat
=
"server"
Text
=
"Pending Calls"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkCalActConsole"
runat
=
"server"
/>
<
asp:Label
ID
=
"calActCnslLbl"
runat
=
"server"
Text
=
"Call Activity for Active Consoles"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkDisptchr"
runat
=
"server"
/>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Call Activity for Active Dispatchers"
ForeColor
=
"#122480"
/><
br
/>
<
asp:CheckBox
ID
=
"chkCalActEndpnt"
runat
=
"server"
/>
<
asp:Label
ID
=
"calActEndpntLbl"
runat
=
"server"
Text
=
"Call Activity for Active Endpoints"
ForeColor
=
"#122480"
/><
br
/>
</
div
>
<
div
class
=
"buttonHolder"
>
<
input
type
=
"button"
id
=
"btnAdd"
value
=
""
class
=
"btnMedium "
title
=
"Add Widget"
/>
<
input
type
=
"button"
id
=
"btnCancel"
value
=
""
class
=
"btnSmall marginActionButton"
title
=
"Cancel"
/>
</
div
>
</
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadDockLayout1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"chkAlrmSumry"
LoadingPanelID
=
"DefaultLoadingPanelID "
UpdatePanelRenderMode
=
"Inline"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"chkActCals"
LoadingPanelID
=
"DefaultLoadingPanelID "
UpdatePanelRenderMode
=
"Inline"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"chkPndCals"
LoadingPanelID
=
"DefaultLoadingPanelID "
UpdatePanelRenderMode
=
"Inline"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"chkCalActConsole"
LoadingPanelID
=
"DefaultLoadingPanelID "
UpdatePanelRenderMode
=
"Inline"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"chkDisptchr"
LoadingPanelID
=
"DefaultLoadingPanelID "
UpdatePanelRenderMode
=
"Inline"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"chkCalActEndpnt"
LoadingPanelID
=
"DefaultLoadingPanelID "
UpdatePanelRenderMode
=
"Inline"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
asp:UpdatePanel
ID
=
"Panel1"
runat
=
"server"
Visible
=
"True"
>
<
ContentTemplate
>
<
telerik:RadDockLayout
runat
=
"server"
ID
=
"RadDockLayout1"
OnLoadDockLayout
=
"RadDockLayout1_LoadDockLayout"
OnSaveDockLayout
=
"RadDockLayout1_SaveDockLayout"
>
<
div
style
=
"width: 100%;"
>
<
div
align
=
"left"
style
=
"width: 72%; float: left"
>
<
table
align
=
"left"
class
=
"style1"
>
<
tr
>
<
td
class
=
"style6"
>
<
telerik:RadDockZone
ID
=
"RadDockZone1"
runat
=
"server"
Height
=
"165px"
Width
=
"300px"
>
</
telerik:RadDockZone
>
</
td
>
<
td
class
=
"style6"
>
<
telerik:RadDockZone
ID
=
"RadDockZone2"
runat
=
"server"
Height
=
"165px"
Width
=
"300px"
>
</
telerik:RadDockZone
>
</
td
>
<
td
class
=
"style6"
>
<
telerik:RadDockZone
ID
=
"RadDockZone3"
runat
=
"server"
Height
=
"165px"
Width
=
"300px"
>
</
telerik:RadDockZone
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"style3"
>
<
telerik:RadDockZone
ID
=
"RadDockZone4"
runat
=
"server"
Height
=
"165px"
Width
=
"300px"
>
</
telerik:RadDockZone
>
</
td
>
<
td
class
=
"style3"
>
<
telerik:RadDockZone
ID
=
"RadDockZone5"
runat
=
"server"
Height
=
"165px"
Width
=
"300px"
>
</
telerik:RadDockZone
>
</
td
>
<
td
class
=
"style3"
>
<
telerik:RadDockZone
ID
=
"RadDockZone6"
runat
=
"server"
Height
=
"165px"
Width
=
"300px"
>
</
telerik:RadDockZone
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
div
>
</
telerik:RadDockLayout
>
<
asp:HiddenField
runat
=
"server"
ID
=
"closedDockZoneId"
/>
<%--stores the id of the RadDockZone, which holds the closed RadDock--%>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<%--Here goes the javascript for the popup--%>
<
script
language
=
"javascript"
type
=
"text/javascript"
>
var popup = 0;
$("#modalRightCenterContent").dialog({
minHeight: 48,
minWidth: 350,
resizable: false,
modal: true,
autoOpen: false,
title: "Add Widgets"
})
.parents(".ui-dialog").find(".ui-dialog-titlebar")
.removeClass("ui-widget-header").addClass("titleBar");
$("#lnkPopup").click(function () {
$("#modalRightCenterContent").dialog('open');
});
$("#btnCancel").click(function () {
$("#modalRightCenterContent").dialog('close');
$("#chkAlrmSumry").removeAttr('checked');
$("#chkActCals").removeAttr('checked');
$("#chkPndCals").removeAttr('checked');
$("#chkCalActConsole").removeAttr('checked');
$("#chkDisptchr").removeAttr('checked');
$("#chkCalActEndpnt").removeAttr('checked');
});
$("#btnAdd").click(function () {
document.location.href = "DashBoard.aspx?Dock1Val=" + chkAlrmSumry.checked + "&Dock2Val=" + chkActCals.checked + "&Dock3Val=" + chkPndCals.checked + "&Dock4Val=" + chkCalActConsole.checked + "&Dock5Val=" + chkDisptchr.checked + "&Dock6Val=" + chkCalActEndpnt.checked + "";
$("#modalRightCenterContent").dialog('close');
$("#chkAlrmSumry").removeAttr('checked');
$("#chkActCals").removeAttr('checked');
$("#chkPndCals").removeAttr('checked');
$("#chkCalActConsole").removeAttr('checked');
$("#chkDisptchr").removeAttr('checked');
$("#chkCalActEndpnt").removeAttr('checked');
});
</
script
>
</
form
>
</
body
>
</
html
>
public partial class DashBoard_DashBoard : System.Web.UI.Page
{
////////////////////////////////////////////////////
//
//!func Page_Load()
//
//!output param - None
//
//!input param - object,EventArgs
//
//!brief -
//
/////////////////////////////////////////////////////
bool[] Dock_flag = { false, false, false, false, false,false};
static RadDock[] zone1 = new RadDock[5];
static RadDock[] zone2 = new RadDock[5];
static RadDock[] zone3 = new RadDock[5];
static RadDock[] zone4 = new RadDock[5];
static RadDock[] zone5 = new RadDock[5];
static RadDock[] zone6 = new RadDock[5];
string result_dock = null;
bool loadPageFlag = false;
private List<
DockState
> CurrentDockStates
{
get
{
// Store the info about the added docks in the session.
List<
DockState
> _currentDockStates = (List<
DockState
>)Session["CurrentDockStatesDynamicDocks"];
if (Object.Equals(_currentDockStates, null))
{
_currentDockStates = new List<
DockState
>();
Session["CurrentDockStatesDynamicDocks"] = _currentDockStates;
}
return _currentDockStates;
}
set
{
Session["CurrentDockStatesDynamicDocks"] = value;
}
}
protected override void OnInit(EventArgs e)
{
if (Session["DockFlags"] != null)
Dock_flag = (bool[])Session["DockFlags"];
for (int i = 0; i <
CurrentDockStates.Count
; i++)
{
if (CurrentDockStates[i].Closed == true)
{
RadDock
dock
=
new
RadDock();
dock.Closed
=
true
;
dock.Visible
=
false
;
//RadDockLayout1.Controls.Remove(dock);
CreateSaveStateTrigger(dock);
}
else
{
RadDock
dock
=
CreateRadDockFromState
(CurrentDockStates[i]);
RadDockLayout1.Controls.Add(dock);
CreateSaveStateTrigger(dock);
}
}
if (!IsPostBack)
{
for (int
i
=
1
; i <=6; i++)
{
result_dock
=
Request
.QueryString["Dock" + i.ToString() + "Val"];
if (result_dock != null && !result_dock.Equals(""))
{
if (result_dock.Equals("true") && Dock_flag[i - 1] == false)
{
loadPageFlag
=
true
;
RadDock
dock
=
CreateRadDock
(i);
// RadDock
dock
=
new
RadDock();
AddToEmptyRadDock(dock);
CreateSaveStateTrigger(dock);
Dock_flag[i - 1] = true;
Session["DockFlags"] = Dock_flag;
}
}
}
}
}
public void AddToEmptyRadDock(RadDock dock)
{
if (RadDockZone1.Docks.Count == 0)
{
RadDockZone1.Controls.Add(dock);
}
else
if (RadDockZone2.Docks.Count == 0)
{
RadDockZone2.Controls.Add(dock);
}
else
if (RadDockZone3.Docks.Count == 0)
{
RadDockZone3.Controls.Add(dock);
}
else
if (RadDockZone4.Docks.Count == 0)
{
RadDockZone4.Controls.Add(dock);
}
else
if (RadDockZone5.Docks.Count == 0)
{
RadDockZone5.Controls.Add(dock);
}
else
if (RadDockZone6.Docks.Count == 0)
{
RadDockZone6.Controls.Add(dock);
}
}
private RadDock CreateRadDockFromState(DockState state)
{
RadDock
dock
=
new
RadDock();
dock.DockMode
= DockMode.Default;
dock.EnableAnimation
=
true
;
dock.EnableRoundedCorners
=
true
;
dock.EnableTheming
=
true
;
dock.Height
=
Unit
.Pixel(165);
dock.Width
=
Unit
.Pixel(300);
dock.ID
=
string
.Format("{0}", state.UniqueName);
dock.ApplyState(state);
dock.Resizable
=
false
;
dock.TitlebarContainer.HorizontalAlign
= HorizontalAlign.Left;
DockCloseCommand
closeCommand
=
new
DockCloseCommand();
closeCommand.AutoPostBack
=
true
;
DockExpandCollapseCommand
expandCommand
=
new
DockExpandCollapseCommand();
expandCommand.AutoPostBack
=
false
;
DockToggleCommand
maximizeCommand
=
new
DockToggleCommand();
maximizeCommand.Text
=
"Maximize"
;
maximizeCommand.CssClass
=
"max"
;
maximizeCommand.AlternateCssClass
=
"min"
;
maximizeCommand.AlternateText
=
"Restore"
;
maximizeCommand.OnClientCommand
=
"Dock_OnMaximizeCommand"
;
//assign client-side event handler
dock.OnClientInitialize
=
"Dock_OnClientInitialize"
;
dock.OnClientCommand
=
"ClientCommand"
;
dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
switch (state.Title.ToString())
{
case "Alarm Summary":
Control
widget
=
LoadControl
("Controls/AlarmSummaryCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock1_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
chkAlrmSumry.Enabled
=
false
;
dock.ContentContainer.Controls.Add(widget);
break;
case "Active Calls":
widget
=
LoadControl
("Controls/ActiveCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock2_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
chkActCals.Enabled
=
false
;
dock.ContentContainer.Controls.Add(widget);
break;
case "Pending Calls":
widget
=
LoadControl
("Controls/PendingCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock3_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
chkPndCals.Enabled
=
false
;
dock.ContentContainer.Controls.Add(widget);
break;
case "Call Activity for Active Consoles":
widget
=
LoadControl
("Controls/CallActivityForConoleCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock4_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
chkCalActConsole.Enabled
=
false
;
dock.ContentContainer.Controls.Add(widget);
break;
case "Call Activity for Active Dispatchers":
widget
=
LoadControl
("Controls/CallActivityForDispatchrCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock5_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
chkDisptchr.Enabled
=
false
;
dock.ContentContainer.Controls.Add(widget);
break;
case "Call Activity for Active Endpoints":
widget
=
LoadControl
("Controls/CallActivityForEndPntCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock6_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.Commands.Add(expandCommand);
chkCalActEndpnt.Enabled
=
false
;
dock.ContentContainer.Controls.Add(widget);
break;
}
return dock;
}
private RadDock CreateRadDock(int i)
{
RadDock
dock
=
new
RadDock();
dock.DockMode
= DockMode.Default;
dock.EnableAnimation
=
true
;
dock.EnableRoundedCorners
=
true
;
dock.EnableTheming
=
true
;
dock.Resizable
=
false
;
dock.TitlebarContainer.HorizontalAlign
= HorizontalAlign.Left;
dock.UniqueName
=
Guid
.NewGuid().ToString();
dock.ID
=
string
.Format("RadDock{0}", dock.UniqueName);
dock.ContentContainer.Style.Add(HtmlTextWriterStyle.OverflowX, "hidden");
//
dock.Title
=
"Dock"
+ i.ToString();
switch (i)
{
case 1:
dock.Title
=
"Alarm Summary"
;
break;
case 2:
dock.Title
=
"Active Calls"
;
break;
case 3:
dock.Title
=
"Pending Calls"
;
break;
case 4:
dock.Title
=
"Call Activity for Active Consoles"
;
break;
case 5:
dock.Title
=
"Call Activity for Active Dispatchers"
;
break;
case 6:
dock.Title
=
"Call Activity for Active Endpoints"
;
break;
}
dock.Height
=
Unit
.Pixel(165);
dock.Width
=
Unit
.Pixel(300);
//assign client-side event handler
dock.OnClientInitialize
=
"Dock_OnClientInitialize"
;
DockCloseCommand
closeCommand
=
new
DockCloseCommand();
closeCommand.AutoPostBack
=
true
;
DockToggleCommand
maximizeCommand
=
new
DockToggleCommand();
maximizeCommand.Text
=
"Maximize"
;
maximizeCommand.CssClass
=
"max"
;
maximizeCommand.OnClientCommand
=
"Dock_OnMaximizeCommand"
;
maximizeCommand.AlternateText
=
"Restore"
;
DockExpandCollapseCommand
expandCommand
=
new
DockExpandCollapseCommand();
dock.OnClientCommand
=
"ClientCommand"
;
switch (dock.Title.ToString())
{
case "Alarm Summary":
Control
widget
=
LoadControl
("~/DashBoard/Controls/AlarmSummaryCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock1_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.ContentContainer.Controls.Add(widget);
break;
case "Active Calls":
widget
=
LoadControl
("~/DashBoard/Controls/ActiveCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock2_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.ContentContainer.Controls.Add(widget);
break;
case "Pending Calls":
widget
=
LoadControl
("~/DashBoard/Controls/PendingCallsCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock3_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.ContentContainer.Controls.Add(widget);
break;
case "Call Activity for Active Consoles":
widget
=
LoadControl
("~/DashBoard/Controls/CallActivityForConoleCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock4_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.ContentContainer.Controls.Add(widget);
break;
case "Call Activity for Active Dispatchers":
widget
=
LoadControl
("~/DashBoard/Controls/CallActivityForDispatchrCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock5_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.ContentContainer.Controls.Add(widget);
break;
case "Call Activity for Active Endpoints":
widget
=
LoadControl
("~/DashBoard/Controls/CallActivityForEndPntCtrl.ascx");
dock.Command += new DockCommandEventHandler(this.Dock6_Command);
dock.Commands.Add(closeCommand);
dock.Commands.Add(maximizeCommand);
dock.ContentContainer.Controls.Add(widget);
break;
}
return dock;
}
private void CreateSaveStateTrigger(RadDock dock)
{
// Ensure that the RadDock control will initiate postback when its position changes on the client or any of the commands is clicked.
// Using the trigger we will "ajaxify" that postback.
dock.AutoPostBack
=
false
;
dock.CommandsAutoPostBack
=
false
;
}
protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)
{
foreach (DockState state in CurrentDockStates)
{
e.Positions[state.UniqueName] = state.DockZoneID;
e.Indices[state.UniqueName] = state.Index;
}
}
protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
{
CurrentDockStates
=
new
List<DockState>();
foreach (DockState ds in RadDockLayout1.GetRegisteredDocksState())
{
CurrentDockStates.Add(ds);
}
Session["DockFlags"] = Dock_flag;
if (loadPageFlag)
{
Page.ClientScript.RegisterStartupScript(typeof(Page), "reloadPage", "<
script
type
=
'text/javascript'
>window.location.href = 'DashBoard.aspx';</
script
>");
loadPageFlag = false;
}
}
protected void Dock1_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Dock_flag[0] = false;
RadDock rad = (RadDock)sender;
rad.Undock();
rad.Dispose();
Refresh();
chkAlrmSumry.Enabled = true;
}
}
protected void Dock2_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Dock_flag[1] = false;
RadDock rad = (RadDock)sender;
rad.Undock();
rad.Dispose();
Refresh();
chkActCals.Enabled = true;
}
}
protected void Dock3_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Dock_flag[2] = false;
RadDock rad = (RadDock)sender;
rad.Undock();
rad.Dispose();
Refresh();
chkPndCals.Enabled = true;
}
}
protected void Dock4_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Dock_flag[3] = false;
RadDock rad = (RadDock)sender;
rad.Undock();
rad.Dispose();
Refresh();
chkCalActConsole.Enabled = true;
}
}
protected void Dock5_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Dock_flag[4] = false;
RadDock rad = (RadDock)sender;
rad.Undock();
rad.Dispose();
Refresh();
chkDisptchr.Enabled = true;
}
}
protected void Dock6_Command(object sender, DockCommandEventArgs e)
{
if (e.Command.Name.Equals("Close"))
{
Dock_flag[5] = false;
RadDock rad = (RadDock)sender;
rad.Undock();
rad.Dispose();
Refresh();
chkCalActEndpnt.Enabled = true;
}
}
protected void moveToDock(RadDockZone fromDock, RadDockZone toDock)
{
for (int i = fromDock.Docks.Count - 1; i >= 0; i--)
{
fromDock.Docks[i].DockZoneID = toDock.ID;
}
}
protected void Refresh()
{
// int closedDockZoneIndex = Int32.Parse(closedDockZoneId.Value.Substring(11, 1));
for (int i = 1; i < RadDockLayout1.RegisteredZones.Count; i++)
{
for (int j = 0; j < i; j++)
{
if (RadDockLayout1.RegisteredZones[j].Docks.Count == 0)
{
moveToDock(RadDockLayout1.RegisteredZones[i], RadDockLayout1.RegisteredZones[j]);
break;
}
}
}
}
}
Dear Experts,
I am using RadGrid to implement a business application showing some tabular data which should be filtered according to the responsible user(owner).
In order to maximize the user experience I used two additional features
The problem is that I am not able to apply default filter on initial load with client side binding. I suppose this should be possible by properly initialize the Grid’s server state that reflects on the client as filterExpressions array.
I tried the following approaches but none seems to be the right one:
I am using (DNN - RadAjax Version: 2011.2.712.35
Has anyone experience with this approach?
Any hint will be highly appreciated.
Thank you,
Kristijan
<add path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2011.1.413.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>
objLookupCellLabel.childNodes[0].setAttribute(
"clientcode"
, Code);
<
telerik:RadGrid
ID
=
"RadGrid1"
AllowMultiRowSelection
=
"False"
AllowSorting
=
"True"
AllowNaturalSort
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
AlternatingItemStyle-HorizontalAlign
=
"Left"
GroupingEnabled
=
"True"
HeaderStyle-HorizontalAlign
=
"Center"
Height
=
"475px"
ItemStyle-HorizontalAlign
=
"Left"
OnSortCommand
=
"RadGrid1_SortCommand"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
PageSize
=
"15"
ShowFooter
=
"True"
ShowHeader
=
"True"
ShowGroupPanel
=
"False"
ShowStatusBar
=
"True"
SelectedItemStyle-ForeColor
=
"#000000"
EnableEmbeddedSkins
=
"False"
Skin
=
"MySkin"
Width
=
"100%"
runat
=
"server"
>
<MasterTableView AllowMultiColumnSorting="True" DataKeyNames="ID" TableLayout="Fixed" HeaderStyle-Wrap="false" Width="100%">
Type
T = Type
.GetType(objectTypeName);
((
typeof(T)))userControl).Controls
But I just wanter to be able to have a reursive call listing out all the children be them Usercontrol or Telerik User controls.
Any Ideas ?
Doug
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
foreach
(object uc in ((UserControl)userControl).Controls){}