or
<telerik:GridBoundColumn DataField=
"last_name"
DataType=
"System.String"
HeaderText=
"Last Name"
SortExpression=
"last_name"
UniqueName=
"last_name"
ShowFilterIcon=
"True"
AutoPostBackOnFilter=
"true"
CurrentFilterFunction=
"Contains"
>
<FilterTemplate>
<telerik:RadComboBox runat=
"server"
ID=
"rcblast"
DataTextField=
"last_name"
DataValueField=
"last_name"
EnableEmbeddedSkins=
"False"
Skin=
"2015"
Width=
"100px"
EnableLoadOnDemand=
"True"
MarkFirstMatch=
"True"
ShowToggleImage=
"False"
OnClientDropDownOpening=
"lastName_ClientDropDownOpening"
OnClientSelectedIndexChanged=
"lastName_ClientSelectedIndexChanged"
OnClientItemsRequesting=
"lastName_ItemsRequested"
OnItemsRequested=
"rcblast_ItemsRequested"
>
</telerik:RadComboBox>
<telerik:RadScriptBlock ID=
"RadScriptBlock2"
runat=
"server"
>
<script type=
"text/javascript"
>
function lastName_ClientSelectedIndexChanged(sender, args) {
$find(
"<%= rgTraining.ClientID %>"
).get_masterTableView().filter(
"last_name"
, args.get_item().get_text(),
"StartsWith"
);
// doesn't seem to work
sender.set_text(args.get_item().get_text());
}
function lastName_ItemsRequested(sender, args) {
if
(args.get_text().length < 3)
args.set_cancel(
true
);
else
args.set_cancel(
false
);
}
function lastName_ClientDropDownOpening(sender, args) {
var comboText = sender.get_text();
if
(comboText.length < 3) {
args.set_cancel(
true
);
}
}
</script>
</telerik:RadScriptBlock>
</FilterTemplate>
<ItemStyle VerticalAlign=
"Top"
/>
<HeaderStyle HorizontalAlign=
"Left"
VerticalAlign=
"Bottom"
Font-Bold=
"True"
Font-Underline=
"True"
/>
</telerik:GridBoundColumn>
foreach (RadComboBoxItem item in rdComboNames.Items)
{
CheckBox chk = (CheckBox)item.FindControl("chk1");
if (i == 0)
{
checkedText += "Names:";
}
else if (chk.Checked)
{
checkedText += item.Text + ", ";
}
i++;
}
My questions are:
1. How to disable the controls on crop dialog like the dropdown menu and the textboxes.
2. How to fire save event on server side and access the modified photo.
<
script
type
=
"text/javascript"
>
function OnClientFilesUploaded(sender, args) {
$find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();
}
var width;
var height;
var heightAfterCrop;
var imageVer1Saved=0; //Sould set to true after saving the 16X9 version
function OnClientImageLoad(imageEditor) {
imageEditor.zoomBestFit();
waitForCommand(imageEditor, 'Crop', function (widget) {
width = imageEditor.getEditableImage().get_width();
height = imageEditor.getEditableImage().get_height();
if (width >= height) {
var ratio = 16 / 9;
heightAfterCrop = width / 16 * 9;
//Panoramic photos
if (height <
heightAfterCrop
) {
heightAfterCrop
= height;
width
=
heightAfterCrop
/ 9 * 16;
}
//stop the aspect ratio constraint
//widget._constraintBtn.set_checked(false);
//widget._setCropBoxRatio(null);
//
widget._sizeRatio
=
null
;
widget._setCropBoxRatio(ratio);
widget._sizeRatio
=
ratio
;
widget.set_width(width);
widget.set_height(heightAfterCrop);
widget._constraintBtn.set_enabled(false);
widget._swapBtn.set_enabled(false);
widget._updateCropBoxFromControls();
}
});
imageEditor.executeCommand("Crop");
}
function waitForCommand(imageEditor, commandName, callback) {
var
timer
=
setInterval
(function () {
var
widget
=
imageEditor
.get_currentToolWidget();
if (widget && widget.get_name() == commandName) {
clearInterval(timer);
callback(widget);
}
}, 100);
}
function modifyCommand(imageEditor, args) {
if (imageVer1Saved == 1)
{
if (args.get_commandName() == "Crop") {
waitForCommand(imageEditor, args.get_commandName(), function (widget) {
width
=
300
;
height
=
300
;
var
ratio
=
width
/ height;
//stop the aspect ratio constraint
//widget._constraintBtn.set_checked(false);
//widget._setCropBoxRatio(null);
//
widget._sizeRatio
=
null
;
widget._setCropBoxRatio(ratio);
widget._sizeRatio
=
ratio
;
widget.set_width(width);
widget.set_height(height);
widget._constraintBtn.set_enabled(false);
widget._updateCropBoxFromControls();
});
}
}
}
function OnClientSaving(sender, eventArgs) {
//Some validation
//if (true) {
// Save using server side code
//}
}
function OnClientSaved(sender, eventArgs) {
imageVer1Saved += 1;
}
</script>
</
telerik:RadScriptBlock
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
EnablePageHeadUpdate
=
"false"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadImageEditor1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
class
=
"borderFullWidthBoxSection"
>
<
div
class
=
"formSection"
>
<
h1
>Upload new photo</
h1
>
<
div
class
=
"formContent"
>
<
telerik:RadAsyncUpload
ID
=
"AsyncUpload1"
runat
=
"server"
OnClientFilesUploaded
=
"OnClientFilesUploaded"
OnFileUploaded
=
"AsyncUpload1_FileUploaded"
MaxFileSize
=
"4194304"
AllowedFileExtensions
=
"jpg,png,gif,bmp"
AutoAddFileInputs
=
"false"
Localization-Select
=
"Browse"
Skin
=
"Silk"
HideFileInput
=
"true"
/>
<
asp:Label
ID
=
"Label1"
Text
=
"*Size limit: 4MB"
runat
=
"server"
Style
=
"font-size: 10px;"
></
asp:Label
>
<
telerik:RadImageEditor
ID
=
"RadImageEditor1"
runat
=
"server"
Width
=
"850"
Height
=
"550"
OnImageLoading
=
"RadImageEditor1_ImageLoading"
OnClientImageLoad
=
"OnClientImageLoad"
OnClientCommandExecuted
=
"modifyCommand"
Skin
=
"Silk"
OnClientSaved
=
"OnClientSaved"
OnClientSaving
=
"OnClientSaving"
>
<
Tools
>
<
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorTool
CommandName
=
"Save"
IsToggleButton
=
"true"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorToolStrip
CommandName
=
"Undo"
>
</
telerik:ImageEditorToolStrip
>
<
telerik:ImageEditorToolStrip
CommandName
=
"Redo"
>
</
telerik:ImageEditorToolStrip
>
<
telerik:ImageEditorTool
Text
=
"Reset"
CommandName
=
"Reset"
/>
</
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorTool
CommandName
=
"Crop"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
CommandName
=
"Resize"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
CommandName
=
"FlipVertical"
ToolTip
=
"Flip Image Vertically"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
CommandName
=
"FlipHorizontal"
ToolTip
=
"Flip Image Horizontally"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
CommandName
=
"RotateRight"
ToolTip
=
"Rotate Right by 90 degrees"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
CommandName
=
"RotateLeft"
ToolTip
=
"Rotate Left by 90 degrees"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
Text
=
"Add Text"
CommandName
=
"AddText"
IsToggleButton
=
"true"
/>
<
telerik:ImageEditorToolSeparator
/>
<
telerik:ImageEditorTool
CommandName
=
"ZoomIn"
ToolTip
=
"Zoom In"
></
telerik:ImageEditorTool
>
<
telerik:ImageEditorTool
CommandName
=
"ZoomOut"
ToolTip
=
"Zoom Out"
></
telerik:ImageEditorTool
>
</
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorTool
Text
=
"Brightness Contrast"
CommandName
=
"BrightnessContrast"
IsToggleButton
=
"true"
/>
<
telerik:ImageEditorTool
Text
=
"Invert Color"
CommandName
=
"InvertColor"
/>
<
telerik:ImageEditorTool
Text
=
"Sepia"
CommandName
=
"Sepia"
/>
<
telerik:ImageEditorTool
Text
=
"Greyscale"
CommandName
=
"Greyscale"
/>
<
telerik:ImageEditorTool
Text
=
"Hue Saturation"
CommandName
=
"HueSaturation"
IsToggleButton
=
"true"
/>
</
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorToolGroup
>
<
telerik:ImageEditorTool
Text
=
"Pencil"
CommandName
=
"Pencil"
IsToggleButton
=
"true"
/>
<
telerik:ImageEditorTool
Text
=
"Draw Circle"
CommandName
=
"DrawCircle"
IsToggleButton
=
"true"
/>
<
telerik:ImageEditorTool
Text
=
"Draw Rectangle"
CommandName
=
"DrawRectangle"
IsToggleButton
=
"true"
/>
<
telerik:ImageEditorTool
Text
=
"Line"
CommandName
=
"Line"
IsToggleButton
=
"true"
/>
</
telerik:ImageEditorToolGroup
>
</
Tools
>
</
telerik:RadImageEditor
>
</
div
>
</
div
>
</
div
>