or
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"rsmQuoteDocument"
>
</
telerik:RadScriptManager
>
<
telerik:RadWindowManager
ID
=
"rwmQuoteDoc"
runat
=
"server"
>
</
telerik:RadWindowManager
>
<
input
id
=
"DcoId"
type
=
"hidden"
runat
=
"server"
/>
<
asp:Button
ID
=
"btnDOC"
runat
=
"server"
OnClick
=
"btnDOC_Click"
Style
=
"display: none"
/>
<
telerik:RadAjaxManager
runat
=
"server"
ID
=
"ramQuotesDoc"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rgQouteDocuments"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rapDocument"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxPanel
ID
=
"rapDocument"
runat
=
"server"
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"rgQouteDocuments"
Skin
=
"Office2007"
Width
=
"99.5%"
ondeletecommand
=
"rgQouteDocuments_OnDeleteCommand"
oninsertcommand
=
"rgQouteDocuments_OnInsertCommand"
onitemdatabound
=
"rgQouteDocuments_OnItemDataBound"
onneeddatasource
=
"rgQouteDocuments_NeedDataSource"
onupdatecommand
=
"rgQouteDocuments_OnUpdateCommand"
AllowAutomaticInserts
=
"false"
AllowAutomaticUpdates
=
"true"
AutoGenerateColumns
=
"false"
>
<
ClientSettings
>
<
Selecting
EnableDragToSelectRows
=
"false"
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
<
ItemStyle
CssClass
=
"RadGridItem"
/>
<
AlternatingItemStyle
CssClass
=
"RadGridItem"
/>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
PageSizeLabelText
=
"Pages"
ShowPagerText
=
"false"
/>
<
MasterTableView
DataKeyNames
=
"QuoteDocumentID,QuoteId"
CommandItemDisplay
=
"Top"
EditMode
=
"EditForms"
>
<
NoRecordsTemplate
>
<
center
>
<
asp:Label
ID
=
"lblnoRecords"
runat
=
"server"
CssClass
=
"label"
Text
=
"No records found"
/>
</
center
>
</
NoRecordsTemplate
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"QuoteDocumentID"
HeaderText
=
"DocumentID"
DataField
=
"QuoteDocumentID"
Visible
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"QuoteId"
HeaderText
=
"Quote ID"
DataField
=
"QuoteId"
Visible
=
"false"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"ViewAppraisal"
ButtonType
=
"ImageButton"
ImageUrl
=
"~/Images/view-inventory.png"
Text
=
"DownLoad"
HeaderStyle-Width
=
"110px"
Visible
=
"false"
>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
</
telerik:GridButtonColumn
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
EditImageUrl
=
"../Images/edit.png"
HeaderStyle-Width
=
"30px"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
ImageUrl
=
"../Images/delete.png"
CommandName
=
"delete"
ItemStyle-HorizontalAlign
=
"Center"
ConfirmDialogType
=
"RadWindow"
ConfirmDialogHeight
=
"25px"
ConfirmDialogWidth
=
"410px"
ConfirmTitle
=
"Delete Document"
ConfirmText
=
"Are you sure you want to delete this Inventory Documents?"
HeaderStyle-Width
=
"30px"
UniqueName
=
"30px"
>
</
telerik:GridButtonColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Document Comment"
EditFormHeaderTextFormat
=
"Comment"
UniqueName
=
"Comment"
DataField
=
"DocumentComment"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblDocumentComment"
runat
=
"server"
Text='<%# Eval("DocumentComment") as string %>' />
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"txbDescription"
Width
=
"250px"
runat
=
"server"
TextMode
=
"MultiLine"
Text='<%# Eval("DocumentComment") %>' Height="150px" />
</
EditItemTemplate
>
<
ItemStyle
VerticalAlign
=
"Top"
/>
</
telerik:GridTemplateColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"DateUploaded"
DataFormatString
=
"{0:dd/MM/yyyy}"
HeaderText
=
"Upload Date"
EditFormHeaderTextFormat
=
"Upload Date"
ReadOnly
=
"True"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"UserId"
HeaderText
=
"Uploaded By"
DataField
=
"UserId"
ReadOnly
=
"True"
Visible
=
"false"
/>
<
telerik:GridBoundColumn
UniqueName
=
"UploadedBy"
HeaderText
=
"Uploaded By"
DataField
=
"UploadedBy"
EditFormHeaderTextFormat
=
"UploadedBy"
ReadOnly
=
"True"
ItemStyle-CssClass
=
"mousepointer"
/>
<
telerik:GridTemplateColumn
HeaderText
=
"Document"
EditFormHeaderTextFormat
=
"Upload Files"
UniqueName
=
"Document"
DataField
=
"DocumentComment"
Visible
=
"false"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"lbtnDocument"
runat
=
"server"
Text='<%#Eval("DocumentPath") %>'></
asp:LinkButton
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
br
/>
<
telerik:RadAsyncUpload
HttpHandlerUrl
=
"~/CustomHandler.ashx"
ID
=
"ruDocument"
runat
=
"server"
AllowedFileExtensions
=
".doc,.docx,.xlsx,.pdf,.dox,.rtf,.txt"
>
</
telerik:RadAsyncUpload
>
(Use format .doc,.docx,.xlsx,.pdf,.dox,.rtf,.txt)
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridButtonColumn
HeaderText
=
"Documents"
ButtonType
=
"LinkButton"
UniqueName
=
"Documents"
DataTextField
=
"FileName"
/>
<
telerik:GridBoundColumn
UniqueName
=
"DocumentName"
DataField
=
"DocumentPath"
Visible
=
"false"
ReadOnly
=
"true"
/>
</
Columns
>
<
CommandItemTemplate
>
<
table
border
=
"0"
style
=
"width: 100%;"
>
<
tbody
>
<
tr
>
<
td
align
=
"left"
>
<
asp:LinkButton
ID
=
"AddNewRecordButton"
runat
=
"server"
CommandName
=
"InitInsert"
>
<
img
style
=
"border:0px"
alt
=
"Add New"
src
=
"../Images/add-icon.png"
/> Add new document
</
asp:LinkButton
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
</
CommandItemTemplate
>
<
EditFormSettings
>
<
EditColumn
ButtonType
=
"ImageButton"
/>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadAjaxPanel
>
<
telerik:RadGrid
ID
=
"competenceGrid"
runat
=
"server"
Width
=
"99%"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
FrozenColumnsCount
=
"4"
>
</
Scrolling
>
<
ClientEvents
OnGridCreated
=
"GridCreated"
/>
</
ClientSettings
>
<
MasterTableView
TableLayout
=
"Fixed"
Width
=
"100%"
Height
=
"100%"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
</
MasterTableView
>
<
HeaderContextMenu
EnableImageSprites
=
"True"
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
<
ItemStyle
HorizontalAlign
=
"Center"
/>
<
ActiveItemStyle
HorizontalAlign
=
"Center"
/>
<
AlternatingItemStyle
HorizontalAlign
=
"Center"
/>
<
HeaderStyle
Width
=
"160px"
Height
=
"75px"
/>
</
telerik:RadGrid
>
<
style
type
=
"text/css"
>
.reToolbar.Default .InsertHotword
{
background-image: url( http://www.telerik.com/DEMOS/ASPNET/RadControls/Editor/Skins/Default/buttons/Custom.gif);
}
</
style
>
<
script
type
=
"text/javascript"
>
Telerik.Web.UI.Editor.CommandList["CustomProperties"] = function(commandName, editor, args)
{
// get the selected Html
var currentSelectedHtml = editor.getSelectionHtml();
var elem = editor.getSelectedElement();
editor.selectElement(elem);
argument = elem;
var myCallbackFunction = function(sender, args)
{
if(args.doPaste == true)
editor.pasteHtml(String.format("<
span
id={0}
contenteditable
=
'false'
class
=
'{1}'
xml
=
'{2}'
>{3}</
span
> ", args.id, args.cssclass, args.xml, args.title))
}
editor.showExternalDialog(
"Hotword.aspx",
argument,
450,
350,
myCallbackFunction,
null,
"Hotword",
true,
Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
false,
false);
};
Telerik.Web.UI.Editor.CommandList["InsertHotword"] = function(commandName, editor, args)
{
// get the selected Html
var currentSelectedHtml = editor.getSelectionHtml();
var elem = editor.getSelectedElement();
if(elem.tagName == 'BODY')
{
var content = editor.getSelectionHtml();
var link = editor.get_document().createElement("FONT");
link.innerHTML = currentSelectedHtml;
argument = link;
}
var myCallbackFunction = function(sender, args)
{
if(args.doPaste == true)
editor.pasteHtml(String.format("<
span
id={0}
contenteditable
=
'false'
class
=
'{1}'
xml
=
'{2}'
>{3}</
span
> ", args.id, args.cssclass, args.xml, args.title))
}
editor.showExternalDialog(
'Hotword.aspx',
argument,
450,
350,
myCallbackFunction,
null,
'Hotword',
true,
Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
false,
false);
};
</
script
>
<
asp:ScriptManager
id
=
"ScriptManager"
runat
=
"server"
/>
<
telerik:RadEditor
ID
=
"rdedContent"
runat
=
"server"
Width
=
"340px"
Height
=
"450px"
SkinID
=
"DefaultSetOfTools"
ToolsFile
=
"AuthoringTools.xml"
>
<
Tools
>
<
telerik:EditorToolGroup
>
<
telerik:EditorTool
Name
=
"InsertHotword"
Text
=
"Hotword"
ShowText
=
"true"
ShowIcon
=
"false"
/>
</
telerik:EditorToolGroup
>
</
Tools
>
<
ContextMenus
>
<
telerik:EditorContextMenu
TagName
=
"A"
Enabled
=
"false"
></
telerik:EditorContextMenu
>
<
telerik:EditorContextMenu
>
<
telerik:EditorTool
name
=
"Cut"
/>
<
telerik:EditorTool
name
=
"Copy"
/>
<
telerik:EditorTool
name
=
"Paste"
/>
<
telerik:EditorTool
name
=
"CustomProperties"
/>
</
telerik:EditorContextMenu
>
</
ContextMenus
>
</
telerik:RadEditor
>
<
asp:ScriptManager
id
=
"ScriptManager"
runat
=
"server"
/>
<
div
>
Hotword Properties:
<
br
/>
title: <
input
type
=
"text"
id
=
"hotwordTitle"
>
<
br
/><
br
/>
Content:
<
telerik:RadEditor
ID
=
"rdedContent"
runat
=
"server"
Width
=
"200px"
Height
=
"150px"
SkinID
=
"DefaultSetOfTools"
ToolsFile
=
"AuthoringTools.xml"
></
telerik:RadEditor
>
<
br
/>
<
input
type
=
"button"
onclick
=
"javascript:insertContent();"
value
=
"OK"
/>
</
div
>
<
script
type
=
"text/javascript"
>
if (window.attachEvent)
{
window.attachEvent("onload", initDialog);
}
else if (window.addEventListener)
{
window.addEventListener("load", initDialog, false);
}
var hotwordTitle = document.getElementById("hotwordTitle");
var hotword = null;
function getRadWindow()
{
if (window.radWindow)
{
return window.radWindow;
}
if (window.frameElement && window.frameElement.radWindow)
{
return window.frameElement.radWindow;
}
return null;
}
function initDialog()
{
var clientParameters = getRadWindow().ClientParameters; //return the arguments supplied from the parent page
hotwordTitle.value = clientParameters.innerHTML;
hotword = clientParameters;
}
function insertContent()
{
//create an object and set some custom properties to it
hotword.id = '1';
hotword.cssclass = 'Hotword';
hotword.xml = 'Hotword';
hotword.title = hotwordTitle.value;
hotword.doPaste = true;
getRadWindow().close(hotword);
}
</
script
>
(inside pageview)...
<
asp:UpdatePanel
runat
=
"server"
ID
=
"UpdatePanel1"
ChildrenAsTriggers
=
"false"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
telerik:RadDockLayout
runat
=
"server"
ID
=
"RadDockLayout1"
OnSaveDockLayout
=
"RadDockLayout1_SaveDockLayout"
OnLoadDockLayout
=
"RadDockLayout1_LoadDockLayout"
>
<
telerik:RadDockZone
runat
=
"server"
ID
=
"RadDockZone1"
Width
=
"550"
MinHeight
=
"50"
Style
=
"float: left"
UniqueName
=
"Folder Zone 1"
>
</
telerik:RadDockZone
>
<
telerik:RadDockZone
runat
=
"server"
ID
=
"RadDockZone2"
Width
=
"320"
MinHeight
=
"50"
Style
=
"float: left; background: #f5f4e8;"
UniqueName
=
"Folder Zone 2"
>
</
telerik:RadDockZone
>
<
telerik:RadDockZone
runat
=
"server"
ID
=
"RadDockZone3"
Width
=
"880"
MinHeight
=
"50"
Style
=
"background: #d5f0fa; float: left;"
UniqueName
=
"Folder Zone 3"
>
</
telerik:RadDockZone
>
<
div
style
=
"display: none"
>
Hidden UpdatePanel, which is used to receive the new dock controls. We will move
them with script to the desired initial dock zone.
<
asp:UpdatePanel
runat
=
"server"
ID
=
"UpdatePanel3"
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"ButtonAddDock"
EventName
=
"Click"
/>
</
Triggers
>
</
asp:UpdatePanel
>
</
div
>
</
telerik:RadDockLayout
>
</
ContentTemplate
>
<
Triggers
>
<
asp:AsyncPostBackTrigger
ControlID
=
"ButtonAddDock"
EventName
=
"Click"
/>
</
Triggers
>
</
asp:UpdatePanel
>
-----------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.Script.Serialization;
using System.Text;
using System.Collections;
public partial class MBA_Folder : System.Web.UI.Page
{
private const string cookiename = "__dockState";
private List<
DockState
> GetDocks(string cookieName)
{
List<
DockState
> currentDocks = new List<
DockState
>();
string dockState;
JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
HttpCookie positionsCookie = Request.Cookies[cookiename];
if (!Object.Equals(positionsCookie, null))
{
dockState = positionsCookie.Value;
string[] currentDockStates = dockState.Split(new Char[] { '|' });
foreach (string stringState in currentDockStates)
{
if (stringState != string.Empty)
{
DockState state = new DockState();
state = serializer.Deserialize<
DockState
>(stringState);
currentDocks.Add(state);
}
}
}
return currentDocks;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownZone.DataBind();
}
}
public ArrayList GetZones()
{
ArrayList zones = new ArrayList();
zones.Add(RadDockZone1);
zones.Add(RadDockZone2);
zones.Add(RadDockZone3);
return zones;
}
private RadDock CreateRadDockFromState(DockState state)
{
RadDock dock = new RadDock();
dock.DockMode = DockMode.Docked;
dock.ID = string.Format("RadDock{0}", state.UniqueName);
dock.ApplyState(state);
dock.Commands.Add(new DockCloseCommand());
dock.Commands.Add(new DockExpandCollapseCommand());
return dock;
}
private RadDock CreateRadDock()
{
RadDock dock = new RadDock();
dock.DockMode = DockMode.Docked;
dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
dock.ID = string.Format("RadDock{0}", dock.UniqueName);
dock.Title = DroptDownWidget.SelectedItem.Text;
dock.Text = string.Format("Added at {0}", DateTime.Now);
dock.Width = Unit.Pixel(300);
dock.Commands.Add(new DockCloseCommand());
dock.Commands.Add(new DockExpandCollapseCommand());
return dock;
}
// void dock_Command(object sender, DockCommandEventArgs e)
// {
// if (e.Command.Name == "Close")
// {
// ScriptManager.RegisterStartupScript(
// UpdatePanel1,
// this.GetType(),
// "RemoveDock",
// string.Format(@"function _removeDock() {{
// Sys.Application.remove_load(_removeDock);
// $find('{0}').undock();
// $get('{1}').appendChild($get('{0}'));
// $find('{0}').doPostBack('DockPositionChanged');
//}};
//Sys.Application.add_load(_removeDock);", ((RadDock)sender).ClientID, UpdatePanel1.ClientID),
// true);
// }
// }
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 = true;
dock.CommandsAutoPostBack = true;
AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();
saveStateTrigger.ControlID = dock.ID;
saveStateTrigger.EventName = "DockPositionChanged";
UpdatePanel1.Triggers.Add(saveStateTrigger);
saveStateTrigger = new AsyncPostBackTrigger();
saveStateTrigger.ControlID = dock.ID;
saveStateTrigger.EventName = "Command";
UpdatePanel1.Triggers.Add(saveStateTrigger);
}
protected void Page_Init(object sender, EventArgs e)
{
List<
DockState
> CurrentDockStates = GetDocks(cookiename);
for (int i = 0; i <
CurrentDockStates.Count
; i++)
{
RadDock
dock
=
CreateRadDockFromState
(CurrentDockStates[i]);
//We will just add the RadDock control to the RadDockLayout.
// You could use any other control for that purpose, just ensure
// that it is inside the RadDockLayout control.
// The RadDockLayout control will automatically move the RadDock
// controls to their corresponding zone in the LoadDockLayout
// event (see below).
RadDockLayout1.Controls.Add(dock);
//We want to save the dock state every time a dock is moved.
CreateSaveStateTrigger(dock);
LoadWidget(dock);
}
}
protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)
{
//Populate the event args with the state information. The RadDockLayout control
// will automatically move the docks according that information.
List<DockState> CurrentDockStates = GetDocks(cookiename);
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)
{
string dockState;
JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<
DockState
> stateList = ((RadDockLayout)sender).GetRegisteredDocksState(true);
StringBuilder serializedList = new StringBuilder();
int i = 0;
while (i < stateList.Count)
{
serializedList.Append(serializer.Serialize(stateList[i]));
serializedList.Append("|");
i++;
}
dockState = serializedList.ToString();
HttpCookie positionsCookie = new HttpCookie(cookiename, dockState);
//Ensure that the cookie will not expire soon
positionsCookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(positionsCookie);
}
protected void ButtonAddDock_Click(object sender, EventArgs e)
{
RadDock dock = CreateRadDock();
//find the target zone and add the new dock there
RadDockZone dz = (RadDockZone)FindControl(DropDownZone.SelectedItem.Text);
dz.Controls.Add(dock);
CreateSaveStateTrigger(dock);
//Load the selected widget in the RadDock control
dock.Tag = DroptDownWidget.SelectedValue;
LoadWidget(dock);
//Right now the RadDock control is not docked. When we try to save its state
// later, the DockZoneID will be empty. To workaround this problem we will
// set the AutoPostBack property of the RadDock control to true and will
// attach an AsyncPostBackTrigger for the DockPositionChanged client-side
// event. This will initiate second AJAX request in order to save the state
// AFTER the dock was docked in RadDockZone1.
CreateSaveStateTrigger(dock);
}
private void LoadWidget(RadDock dock)
{
if (string.IsNullOrEmpty(dock.Tag))
{
return;
}
Control widget = LoadControl(dock.Tag);
dock.ContentContainer.Controls.Add(widget);
}
protected void ButtonPostBack_Click(object sender, EventArgs e)
{
//normal postback
}
protected void ButtonClear_Click(object sender, EventArgs e)
{
//clear docks state from the session
//CurrentDockStates.Clear();
//_dockStateCleared = true;
}
}
protected
void
Page_Init(
object
sender, System.EventArgs e)
{
captcha =
new
Telerik.Web.UI.RadCaptcha();
captcha.ID =
"captcha"
;
captcha.ErrorMessage =
"The security code you entered did not match. Please try again."
;
captcha.EnableRefreshImage =
true
;
captcha.CaptchaAudioLinkButtonText =
"Play Audio Code"
;
captcha.CaptchaImage.EnableCaptchaAudio =
true
;
captcha.CaptchaImage.AudioFilesPath = Server.MapPath(
"/forms/RadCaptcha"
);
captcha.CaptchaImage.UseAudioFiles =
true
;
captcha.CaptchaTextBoxLabel = String.Empty;
captcha.Visible =
true
;
divCaptcha.Controls.Add(captcha);
}