Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
215 views

Im trying to SAVE the resulting image to the server. Tried following some sample code with no luck

Sever side code never fires

(Code simple passes a MEMORY STREAM object to  a function (doc.AddVersion) that will save the content into the database)

 

Error: Sys.ArgumentException: Cannot deserialize empty string.
Parameter name: data ScriptResource.axd:50457:2736
    create
    argument
    deserialize
    _readJson
    _finishOperation
    createCallback
    createDelegate
    WebForm_ExecuteCallback
    WebForm_CallbackComplete
 
Protected Sub RadImgEdt_ImageSaving(sender As Object, args As Telerik.Web.UI.ImageEditorSavingEventArgs)
       Dim doc As Object = tableDocumentGeneric.getDocument()
       Dim img As Telerik.Web.UI.ImageEditor.EditableImage = args.Image
       Dim ms As New IO.MemoryStream
       img.CopyToStream(ms)
       doc.AddVersion(ms)
       args.Cancel = True
   End Sub

 

<telerik:RadImageEditor ID="RadImageEditor1" runat="server"
    OnClientImageLoad="OnClientImageLoad"
    OnClientCommandExecuting="OnClientCommandExecuting"
    OnImageSaving="RadImgEdt_ImageSaving"
    Style="top: 0px; left: 0px;" Width="100%" Height="100%">
    <EditableImageSettings MaxJsonLength="2147483640" />
    <Tools>
        <telerik:ImageEditorToolGroup>
            <telerik:ImageEditorTool CommandName="Print"/>
            <telerik:ImageEditorTool CommandName="Save" />
            <telerik:ImageEditorTool CommandName="Crop" />
            <telerik:ImageEditorTool CommandName="Zoom" />
            <telerik:ImageEditorToolStrip Text="Undo" CommandName="Undo" />
            <telerik:ImageEditorToolStrip Text="Redo" CommandName="Redo" />
            <telerik:ImageEditorTool Text="Rotate Right" CommandName="RotateRight" />
            <telerik:ImageEditorTool Text="Rotate Left" CommandName="RotateLeft" />
            <telerik:ImageEditorTool Text="Reset" CommandName="Reset" />
        </telerik:ImageEditorToolGroup>
    </Tools>
</telerik:RadImageEditor>
 
<script>
    (function (global, undefined) {
        Telerik.Web.UI.ImageEditor.CommandList["Print"] = function (imgEditor, commandName, args) {
            printIT();
        };
    })(window);
    function printIT() {

        //redirect to show PDF version of item

    }
 
    function OnClientImageLoad(imageEditor, args) {
        imgEditor = imageEditor;
        imgEditor.set_height(document.body.scrollHeight - 50);
        imageEditor.zoomBestFit();
    }
 
    //SAVE
    function OnClientCommandExecuting(imageEditor, eventArgs) {
        if (eventArgs.get_commandName() == 'Save') {
            console.log(eventArgs);
            imageEditor.saveImageOnServer('', true);
            //Prevent the buil-in Save dialog to pop up
            imageEditor.setToggleState('Save', false);
            imageEditor.saveImageOnServer('', true);
            eventArgs.set_cancel(true);
 
        }
    }
 
</script>
Vessy
Telerik team
 answered on 15 Jan 2020
2 answers
121 views
How can I remove a row from a RadGrid randomly by clicking a button outside the RadGrid? Let's say I am using random numbers, and I want the row with the same index as the random number i create to be removed. But I also want to get the DataKeyName from that row so I can use it to tell in a label what row has been removed.
Roy
hurman
Top achievements
Rank 1
 answered on 15 Jan 2020
5 answers
1.6K+ views

Hi,

I need to use bootstrap's modal and no controls are working inside those modals but of course outside the modals.

I am talking about a very simple one. Let's consider the following:

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">
 
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">

...

If I place a button inside a div with the class "modal", add an server side event handler, it never will be triggered when clicked.

Pushing the same button outside the modal works perfectly and the event is triggered.

The same happens to the RadDatePicker: The selected date cannot be used by other controls if the RadDatePicker is in the modal.

I am using Bootstrap v3.3.5 and almost about to despair of this :S

Hope someone can help.

 

Best regards

Peter Milchev
Telerik team
 answered on 14 Jan 2020
5 answers
114 views

In our webapp each time the user clicks on a node in the tree, the node drops down and shows a "loading" (in nodes place) graphic for a second - then node pops back in place an shows the content of the node.  Is there a way to change this behavior of the UI?  Preferably not have the selected node drop down - just replace the text temporarily with loading image - or loading image at end of text, or turn off the loading image.  Distracting to have the tree nodes jump up/down each time clicked.

 

Rumen
Telerik team
 answered on 14 Jan 2020
3 answers
1.1K+ views

I am starting to work on a new project using AutoCompleteBox and I need to change my searches after every entry added by the client.

I am using the tutorial code that uses SQLDataSource. I tried to update the value of the property SQLDataSource.SelectCommand with a new query into the OnEntryAdded event this way:

Protected Sub RadAutoCompleteBox1_EntryAdded(sender As Object, e As Telerik.Web.UI.AutoCompleteEntryEventArgs)
        SqlDataSource1.SelectCommand = "my new query here"
End Sub

The problem is that the event is being triggered and the content of SqlDataSource1.SelectCommand is being changed but AutoCompleteBox keep using the initial hard coded query of the client side script.

Any idea?

Yan Moura
Top achievements
Rank 1
Veteran
Iron
 answered on 13 Jan 2020
1 answer
149 views

Hi , 
  I am try to bind value from server side, for that , i page load i get values in datatable and bind in searchbox, and in DataSourceSelect i filter the values when key in inside search box, but when i key in i get error "Datasoruce not set ", how to bind datasource from server side instead of code behind ?

This is my code
Code Behind
<telerik:RadSearchBox EnableAutoComplete="true" DataValueField="userid"
            DataTextField="con" ID="radsearachUsers"  runat="server"></telerik:RadSearchBox>
--------------------------------

Page_Load
 Dim sqlDA As New SqlDataAdapter("Select con,userid from users", objConnection)
            Dim objDT As New DataTable
            sqlDA.Fill(objDT)

            radsearachUsers.DataSource = objDT
            radsearachUsers.DataValueField = "userid"
            radsearachUsers.DataTextField = "con"
            radsearachUsers.DataBind()

__________________________________

 Protected Sub radsearachUsers_DataSourceSelect(sender As Object, e As SearchBoxDataSourceSelectEventArgs) Handles radsearachUsers.DataSourceSelect
        Dim objConnection As New SqlConnection
        objConnection = New SqlConnection(getconnectionstring())
        objConnection.Open()

        Dim sqlDA As New SqlDataAdapter(" Select * from users where con like '%" & e.FilterString & "%' ", objConnection)
        Dim objDT As New DataTable
        sqlDA.Fill(objDT)
     

        radsearachUsers.DataSource = objDT
        radsearachUsers.DataSourceID = getconnectionstring()
        radsearachUsers.DataTextField = objDT.Rows(0)("Con")
        radsearachUsers.DataValueField = objDT.Rows(0)("userid")
        radsearachUsers.DataBind()
    End Sub

Pls reply asap

Thanks

M Kumar
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 13 Jan 2020
1 answer
126 views

As per the documentation on .fetch():

"The fetch method makes a request to the remote service only the first time it is called"

Why???

 

If a RadGrid is client bound to RadClientDataSource,  I can call .rebind() on the grid and it will call the Select webservice again,   so there must be a way to "reset" something so that .fetch() will call the webservice every time it's called?

CDK
Top achievements
Rank 1
 answered on 10 Jan 2020
1 answer
109 views
The controls in my RadWindow use em unit for width to accommodate the browser's font-size selection by user. So I want to set the RadWindows' width in em also, but I found its not working. Any advice?
Rumen
Telerik team
 answered on 10 Jan 2020
1 answer
126 views

Hello,

trying to HorizontalAlign two (of multiple) columns in a pdf export. I've tried:

protected void btnExport_Click(object sender, EventArgs e)
{
     // bla bla
     MyGrid.MasterTableView.GetColumn("col1").ItemStyle.HorizontalAlign = HorizontalAlign.Center;
}

 

and this way:

protected void MyGrid_PreRender(object sender, EventArgs e)
{
     // bla bla
     foreach (GridColumn col in MyGrid.MasterTableView.RenderColumns)
                {
                    if (col.UniqueName == "col1") { col.ItemStyle.HorizontalAlign = HorizontalAlign.Center; }
                }
}

 

Both do not work - what's the correct way to do this?

Thx in advance - M.

Eyup
Telerik team
 answered on 09 Jan 2020
4 answers
191 views

Tried to add custom buttons to toolbar.

rightsButton = new RadToolBarButton();
rightsButton.ToolTip = CreaSoft.CommonServices.ResourceHelpers.GetGlobalResourceObject("FileExplorerControl.DirectoryRights");
rightsButton.Value = "ManageRightsFolder";
rightsButton.CommandName = "ManageRightsFolder";
 
Explorer.ToolBar.Items.Add(rightsButton);

 

Then I found it doesn't work as expected. Seems that icons are missing (ok, I didn't define any, but found now way how to do it), but based on html, it generates tooltip as css class :-) 

Then I found some strange code in Telerik_UI_for_ASP.NET_AJAX_2018_3_910_Source\Telerik.Web.UI\FileExplorer\RadFileExplorer.cs.

private void ConfigureToolbarButtons()
{
    bool isClassicMode = RenderMode == UI.RenderMode.Classic;
 
    if (!isClassicMode)
    {
        _toolbar.EnableImageSprites = true;
    }
 
    string icn = "icn";
    foreach (RadToolBarItem button in _toolbar.Items)
    {
        bool hasText = !String.IsNullOrEmpty(button.Text) && button.Text != Nbsp;
        string iconCssClass = String.Concat(icn, button.ToolTip);
        if (isClassicMode)
        {
            button.CssClass += hasText ? string.Empty : " rtbIconOnly ";
            button.CssClass += iconCssClass;
        }
        else
        {
            button.ShowText = hasText ? ToolBarShowPosition.Toolbar : ToolBarShowPosition.OverFlow;
            button.SpriteCssClass = iconCssClass;
        }
    }
}

 

So it seems to be a bug in this method. Css class should not be generated from Tooltip :-)

Please see attachments.

 

Rumen
Telerik team
 answered on 09 Jan 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?