Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
364 views
Hi,

I have a RadGrid working where on add and edit events a user control is defined to be used for user inputs.
Now I have a scenario where I want to clone one of the record from a button (placed on that user control).
When user clicks clone button, I want to fire up the "Add new record" event of RadGrid and populate data from the source record so the user may change some values and click save to clone the record.

I cannot find a way to fire the "Add new record" event from a custom button on the usercontrol. Any help ideas to achieve this are appreciated.

Thanks,
Bash
Mark
Top achievements
Rank 2
 answered on 23 Jul 2019
3 answers
713 views

 

I have the following button:

                  <telerik:RadLinkButton ID="lbtn" runat="server" Text="Delete"
                                       Height="34px" 
                                       style="margin-top:2px;"
                                       OnClientClicking="return false;">
                    <Icon CssClass="rbRemove"></Icon>
                </telerik:RadLinkButton>

 

It does that i need it to do however causes "Uncaught SyntaxError: Unexpected token return" javascript error.

What is wrong?

Thank you

Rumen
Telerik team
 answered on 23 Jul 2019
3 answers
282 views

Hello,

I need to disable the edit and insert modal without disabling the drag and drop and resize functionality for appointments. I am currently handling the server side AppointmentClick on my own and I don't want the default edit modal to display when I double click the appointment. Is there a way to just disable the edit modal without affecting the resize appointment, delete appointment and drag and drop update?

 

Thanks for your help

Gonzalo
Top achievements
Rank 1
 answered on 23 Jul 2019
3 answers
168 views

Hi,

I am using Radwindow in my asp.net application as below

 

    <telerik:RadWindow VisibleOnPageLoad="false" Behaviors="Close,Move,Maximize,Resize" VisibleStatusbar="false" VisibleTitlebar="true" Modal="true"     ShowContentDuringLoad="false" ID="rwEdit" runat="server" KeepInScreenBounds="true" InitialBehaviors="Maximize" Style="z-index: 9000"     AutoSizeBehaviors="Width, Height" AutoSize="true">
     </telerik:RadWindow>

 

In my javascript I set the url and display the window

 

    var rWindow = $find(rwEdit);
    if (rWindow) {
        //rWindow.allow = 'camera';   // Tried to set the camera
        rWindow.setSize(1000, 800);
        rWindow.set_title('Open Form');
        rWindow.set_modal(true);
        rWindow.setActive(true);
        rWindow.setUrl('http://localhost:8080/execute/1563377889038?pid=1');
        rWindow.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Maximize);
        rWindow.show();
        rWindow.add_close(OnClientClose);

}

 

On executing the Radwindow creates a iframe (as seen in dev tools) with the same id as RadWindow. I want to use the camera(webcam) within the iframe. I have tried giving the attribute 'allow' in the javascript but it does not work. 

 

Could I please have some help with this? How can I enable the feature policy of 'camera'?

 

Thanks

Deepam

 

Rumen
Telerik team
 answered on 23 Jul 2019
5 answers
560 views
Hi,
I'm have a page called FileManager.aspx that is calling another page called FileUpload.aspx in a RadWindow.

The FileUpload.aspx (in a RadWindow) has one asp:Button (uxFileUploadReturnButton) that submits the form and has a OnClick event named FileUploadReturnButton_Click .

In this click event, it iterates through the UploadedFiles (UploadedFileCollection) and does several business logic - one of which is to use the SaveAs method to save the file in a different file name (GUID in my case).

However, when doing the above, I encountered an error saying that the "temporary file" cannot be found.

When debugging, I notice that upon reaching my click event handler in my presenter class, the files has already been moved over to the Target Folder - with their original file names.

I'm not certain where the problem is to achieve using the SaveAs method in my asp.net web application.

Note: I've registered the Panel which contains the AsynchUpload control to the RadAjaxManager.
Note: I'm using RadControls version 2010.1 309 in VS 2008 SP1

FileMangager.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Dev/AccountLayout.master" AutoEventWireup="true" CodeBehind="FileManager.aspx.cs" Inherits="Dev.FileManager" %> 
<asp:Content ID="uxFileManagerContentContainerContent" ContentPlaceHolderID="uxAccountLayoutContentContainerContentPlaceHolder" runat="server">  
 
<asp:Button ID="Button1" runat="server" Text="Upload Files" /> 
 
<telerik:RadWindow ID="RadWindow2" runat="server"  OpenerElementId="<%# Button1.ClientID %>" NavigateUrl="~/FileUpload/" 
    AutoSize="false" Behaviors="Close" DestroyOnClose="true" KeepInScreenBounds="true" Modal="true" 
    RegisterWithScriptManager="true" Title="Upload File" VisibleStatusbar="false" Width="600" Height="350">  
</telerik:RadWindow > 
 
</asp:Content> 
 

FileUpload.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Dev/WindowLayout.master" AutoEventWireup="true" CodeBehind="FileUpload.aspx.cs" Inherits="Dev.FileUpload" Theme="Default" %> 
<asp:Content ID="uxFileUploadContentContainerContent" ContentPlaceHolderID="uxWindowLayoutContentContainerContentPlaceHolder" runat="server">  
    <div id="uxFileUploadContainerWrapperDiv">  
        <div id="uxFileUploadContainerDiv">  
            <asp:Panel ID="uxFileUploadContainerPanel" runat="server">  
                <div id="uxFileUploadHeaderWrapperDiv">  
                    <div id="uxFileUploadHeaderDiv">  
                        <asp:Panel ID="uxFileUploadBeginUploadHeaderPanel" CssClass="cssFileUploadBeginUploadHeaderPanel" runat="server" Visible="true">  
                            <h1> 
                                <asp:Label ID="uxFileUploadBeginUploadTitleLabel" CssClass="cssFileUploadBeginUploadTitleLabel" runat="server" Text="Upload to My Files"></asp:Label>      
                            </h1> 
                        </asp:Panel> 
                        <asp:Panel ID="uxFileUploadEndUploadHeaderPanel" CssClass="cssFileUploadEndUploadHeaderPanel" runat="server" Visible="false">  
                            <h1> 
                                <asp:Label ID="uxFileUploadEndUploadTitleLabel" CssClass="cssFileUploadEndUploadTitleLabel" runat="server" Text="Upload Complete"></asp:Label> 
                            </h1> 
                        </asp:Panel> 
                    </div> 
                </div> 
                <div id="uxFileUploadContentWrapperDiv">  
                    <div id="uxFileUploadContentDiv">  
                        <asp:Panel ID="uxFileUploadBeginUploadContentPanel" CssClass="cssFileUploadBeginUploadContentPanel" runat="server" Visible="true">  
                            <telerik:RadProgressManager ID="uxFileUploadRadProgressManager" runat="server" EnableMemoryOptimization="true" RegisterWithScriptManager="true" /> 
                            <div id="uxFileUploadFileListHeaderDiv">  
                                <div id="uxFileUploadFileNameColumnDiv">  
                                    <asp:Label ID="uxFileUploadFileNameColumnLabel" runat="server" Text="File Name"></asp:Label>      
                                </div> 
                                <div id="uxFileUploadRemoveColumnDiv">  
                                    <asp:Label ID="uxFileUploadRemoveColumnLabel" runat="server" Text="Remove?"></asp:Label>      
                                </div> 
                            </div> 
                            <div id="uxFileUploadFileListContainerDiv" class="cssFileUploadFileListContainerDiv">  
                                <telerik:RadAsyncUpload ID="uxFileUploadRadAsyncUpload" CssClass="cssFileUploadRadAsyncUpload" runat="server" AutoAddFileInputs="true"   
                                    ControlObjectsVisibility="None" EnableFileInputSkinning="true" FocusOnLoad="true" Localization-Select="Add File" 
                                    ReadOnlyFileInputs="true" OnFileUploaded="FileUploadRadAsyncUpload_FileUploaded" RegisterWithScriptManager="true">  
                                </telerik:RadAsyncUpload> 
                                <telerik:RadProgressArea ID="uxFileUploadRadProgressArea" CssClass="cssFileUploadRadProgressArea" runat="server" RegisterWithScriptManager="true" 
                                    ProgressIndicators="FilesCountBar,FilesCount,FilesCountPercent,SelectedFilesCount,CurrentFileName,TimeElapsed,TimeEstimated">  
                                </telerik:RadProgressArea> 
                            </div>                          
                            <div id="uxFileUploadFileListFooterDiv">  
                                <div id="uxFileUploadTotalsDiv">  
                                    <asp:Label ID="uxFileUploadTotalLabel" CssClass="cssFileUploadTotalLabel" runat="server" Text="Total:"></asp:Label> 
                                    <asp:Label ID="uxFileUploadFileCountLabel" CssClass="cssFileUploadFileCountLabel" runat="server" Text="0"></asp:Label> 
                                    <asp:Label ID="uxFileUploadUnitFileLabel" CssClass="cssFileUploadUnitFileLabel" runat="server" Text="files,"></asp:Label> 
                                    <asp:Label ID="uxFileUploadFileSizeLabel" CssClass="cssFileUploadFileSizeLabel" runat="server" Text="0"></asp:Label> 
                                    <asp:Label ID="uxFileUploadUnitSizeLabel" CssClass="cssFileUploadUnitSizeLabel" runat="server" Text="MB"></asp:Label> 
                                </div> 
                            <br /> 
                            </div> 
                            <div id="uxFileUploadUserActionDiv" class="cssFileUploadUserActionDiv">  
                                <asp:Button ID="uxFileUploadSaveFilesButton" runat="server" Text="Save Uploaded Files" OnClick="FileUploadSaveFilesButton_Click" /> 
                            </div> 
                        </asp:Panel> 
                        <asp:Panel ID="uxFileUploadEndUploadContentPanel" CssClass="cssFileUploadEndUploadContentPanel" runat="server" Visible="false">  
                            <asp:Label ID="uxFileUploadEndUploadMessageLabel" CssClass="cssFileUploadEndUploadMessageLabel" runat="server" Text="Your upload was completed successfully."></asp:Label> 
                            <asp:Button ID="uxFileUploadReturnButton" CssClass="cssFileUploadReturnButton" runat="server" Text="Return to My Files" OnClick="FileUploadReturnButton_Click" /> 
                        </asp:Panel> 
                    </div> 
                </div> 
                <div id="uxFileUploadFooterWrapperDiv">  
                    <div id="uxFileUploadFooterDiv">  
                    </div> 
                </div> 
            </asp:Panel> 
        </div> 
    </div> 
</asp:Content> 

FileUpload.aspx.cs

        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!this.IsPostBack)  
            {  
                Presenter.ViewInitializedEventHandler(sender, e);  
            }  
            else 
            {  
                Presenter.ViewLoadedEventHandler(sender, e);  
            }  
        } 

        protected void FileUploadSaveFilesButton_Click(object sender, EventArgs e)  
        {  
            if (FileUploadSaveFilesButtonClickEventHandler != null)  
            {  
                FileUploadSaveFilesButtonClickEventHandler(sender, e);  
            }  
        } 

FileUploadPresenter.cs (class library)

        public override void ViewInitializedEventHandler(object sender, EventArgs e)  
        {  
            // View initilization logic.  
            ConfigureAjaxSettings();  
            ConfigureControls();  
            LoadViewData();  
        }  
 
        public override void ViewLoadedEventHandler(object sender, EventArgs e)  
        {  
            // View loaded logic.  
            ConfigureAjaxSettings();  
 
            // Delegate view events to the presenter.  
            ConfigureEventHandlers();  
        }  
 
        private void ConfigureAjaxSettings()  
        {  
            View.WindowLayoutRadAjaxManager.AjaxSettings.AddAjaxSetting(View.FileUploadSaveFilesButton, View.FileUploadBeginUploadContentPanel);  
        }  
 
        private void ConfigureEventHandlers()  
        {  
            View.FileUploadSaveFilesButtonClickEventHandler += new EventHandler<EventArgs>(FileUploadSaveFilesButtonClickEventHandler);  
            View.FileUploadReturnButtonClickEventHandler += new EventHandler<EventArgs>(FileUploadReturnButtonClickEventHandler);  
            View.FileUploadRadAsyncUploadFileUploadedEventHandler += new EventHandler<FileUploadedEventArgs>(FileUploadRadAsyncUploadFileUploadedEventHandler);  
        } 

        private void FileUploadSaveFilesButtonClickEventHandler(object sender, EventArgs e)  
        {  
            string targetFolder = _configurationDefinition.FileUploadTargetFolder;  
            int upperBound = View.FileUploadRadAsyncUpload.UploadedFiles.Count;  
            string[] fileSystemNames = new string[upperBound];  
            string[] uploadedFileNames = new string[upperBound];  
            string[] fileTitles = new string[upperBound];  
            int[] fileSizes = new int[upperBound];  
            string[] fileContentTypes = new string[upperBound];  
            string[] fileExtensions = new string[upperBound];              
              
            try 
            {  
                UploadedFileCollection uploadedFiles = View.FileUploadRadAsyncUpload.UploadedFiles;  
                for (int index = 0; index < uploadedFiles.Count; index++)  
                {  
                    fileSystemNames[index] = _cryptographyService.GenerateAlphaNumericGUID();  
                    uploadedFileNames[index] = uploadedFiles[index].GetName();  
                    fileTitles[index] = uploadedFiles[index].GetNameWithoutExtension();  
                    fileSizes[index] = uploadedFiles[index].ContentLength;  
                    fileContentTypes[index] = uploadedFiles[index].ContentType;  
                    fileExtensions[index] = uploadedFiles[index].GetExtension();  
                    // Save the file as a GUID file name  
                    uploadedFiles[index].SaveAs(targetFolder + fileSystemNames[index]);  
                }  
 
                // Add the files to database  
                _fileUploadService.AddFiles(fileSystemNames, uploadedFileNames, fileTitles, fileSizes, fileContentTypes, fileExtensions);  
 
                // Display the File Upload Complete view  
                ToggleFileUploadViews();  
            }  
            catch 
            {  
                try 
                {  
                    // For any errors delete the files that were moved to the Target Folder  
                    foreach (string fileSystemName in fileSystemNames)  
                    {  
                        if (System.IO.File.Exists(targetFolder + fileSystemName))  
                        {  
                            System.IO.File.Delete(targetFolder + fileSystemName);  
                        }  
                    }  
                }  
                catch 
                {  
                    throw;  
                }  
            }  
        } 

Error Message

System.IO.FileNotFoundException was caught
  Message="Could not find file 'C:\\Dev\\App_Data\\TemporaryFiles\\1lsi1z34.y5v'."
  Source="mscorlib"
  FileName="C:\\Dev\\App_Data\\TemporaryFiles\\1lsi1z34.y5v"
  StackTrace:
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.File.Move(String sourceFileName, String destFileName)
       at Telerik.Web.UI.AsyncUploadedFile.SaveAs(String fileName, Boolean overwrite)
       at Dev.FileUploadPresenter.FileUploadSaveFilesButtonClickEventHandler(Object sender, EventArgs e) in C:\Dev\FileUploadPresenter.cs:line 125

Many Thanks,
Henry Wu
saurabh
Top achievements
Rank 1
 answered on 23 Jul 2019
1 answer
208 views

Hey guys, i have been coding a radgrid with the option to export the data as excel and word. That all works just fine also the export, but when i change visible true/false the export buttons suddenly will not trigger as the first time.

I have these export buttons inside a radpagelayout. The 3'rd button "btnAddP" has visibility change, so when i click it it will hide the export buttons. When the visibility is back to export buttons, they don't do anything when clicked. I wanted to hear some suggestions from you guys and maybe if someone have had the same issue and how to handle it properly. 

01.<Columns>
02.        <telerik:LayoutColumn Span="8">
03.          <telerik:RadPageLayout ID="rplRadgrid" runat="server">
04.            <telerik:LayoutRow>
05.              <Columns>
06.                <telerik:LayoutColumn Span="4">
07.                  <telerik:RadButton ID="ibtnExportAsExcel" runat="server" ToolTip="Excel" OnClick="ibtnExportAsExcel_Click" CssClass="Margin">
08.                    <Image ImageUrl="~/Images/filetype-tiny.xls.png" />
09.                  </telerik:RadButton>
10.                  <telerik:RadButton ID="ibtnExportAsWord" runat="server" ToolTip="Word"                         OnClick="ibtnExportAsWord_Click"
11.                    <Image ImageUrl="~/Images/filetype-tiny.doc.png" />
12.                  </telerik:RadButton>
13.                  <telerik:RadButton ID="btnAddP" runat="server" OnClick="btnAddParticipants_Click"
14.                    <Image ImageUrl="../Images/edit-tiny.png" />
15.                  </telerik:RadButton>
16.                </telerik:LayoutColumn>
17.              </Columns>
18.            </telerik:LayoutRow>

......

 

void ConfigureExport()
    {
      
      radgrid.ExportSettings.UseItemStyles =
      radgrid.ExportSettings.ExportOnlyData =
      radgrid.ExportSettings.IgnorePaging =
      radgrid.ExportSettings.OpenInNewWindow = true;
 
      radgrid.ExportSettings.FileName = Resources.c3.Export;
    }
protected void ibtnExportAsExcel_Click(object sender, EventArgs e)
  {
    ConfigureExport();
    radgrid.MasterTableView.ExportToExcel();
  }
 
  protected void ibtnExportAsWord_Click(object sender, EventArgs e)
  {
    ConfigureExport();
    radgrid.MasterTableView.ExportToWord();
  }

 

protected void btnAddP_Click(object sender, EventArgs e)
    {
      tmrChatBoard.Enabled = false;
      rplUpdateP.Visible = true;
      rplRadgrid.Visible = false;
 
    }
Rumen
Telerik team
 answered on 23 Jul 2019
3 answers
103 views
Hii
I'm using radeditor 2015
How can i limit the lines to 70 chars , split lines after the 70 chars, without cutting the word.
Thanks
Rumen
Telerik team
 answered on 22 Jul 2019
16 answers
204 views

The application that I'm building is a document repository / content management system. I am using the editor for creating AND displaying a read-only verision of the documents. The issue I'm having now is that if the editor is in Preview Mode, the ribbon is disabled (there is functionality in it that we want available at all times... print, export to word, redirect to the full editor version of the page).  But if the editor is in Design Mode, any href's are not able to be clicked (they are treated as raw text).  I don't want users to be able to type into this editor, so I have it in Design Mode, but with enableEditing set to false. But having enableEditing turned off causes the context menu (where a user could normally follow a link from one of the selections) to not appear and they get the default windows context menu instead.

 

I'd really prefer to keep the ribbon (for visual consistency) and let it work as designed, as opposed to creating a series of buttons that appear on the top of the page.

 

Any suggestions on how to overcome this?

Rumen
Telerik team
 answered on 22 Jul 2019
4 answers
116 views

I'd like to remove all context menu options except for "Open Link" on the hyperlink context menu.  I've tried to manually set the context menus (based off of old code found in the forums), but it doesn't seem to be working.  Is there a list somewhere that tells me ALL of the context menus so that I can disable them?  And am I missing something on the method of disabling them?  The snippet below represents a few things I've tried.  It seems to remove the context menu for "A", but that's the one I'm trying to keep (although I'd like to strip it down to the single "Open Link" option).

 

This is one of the workarounds I'm trying in regards to my other question from a few days ago (no answers on that one yet either)

 

Thanks so much for any help!

 

<ContextMenus>
    <telerik:EditorContextMenu TagName="P" Enabled="false">
        <telerik:EditorTool Name="JustifyLeft" Enabled="false" />
        <telerik:EditorTool Name="JustifyCenter" Visible="false" />
        <telerik:EditorTool Name="JustifyRight" Visible="false" />
        <telerik:EditorTool Name="JustifyFull" Visible="false" />
    </telerik:EditorContextMenu>
    <telerik:EditorContextMenu TagName="BODY" Enabled="false">
        <telerik:EditorTool Name="Cut" Visible="false" />
        <telerik:EditorTool Name="Copy" Visible="false" />
        <telerik:EditorTool Name="Paste" Visible="false" />
        <telerik:EditorTool Name="PasteFromWord" Visible="false" />
        <telerik:EditorTool Name="PastePlainText" Visible="false" />
        <telerik:EditorTool Name="PasteAsHtml" Visible="false" />
    </telerik:EditorContextMenu>
</ContextMenus>
Rumen
Telerik team
 answered on 22 Jul 2019
5 answers
1.0K+ views
I am trying to loop through each item in a radlistview, not just the selected item. I have been tying to figure this out based on examples for standard listviews. This is how I've been shown to do it in a normal listview:


foreach (ListViewItem itemRow in this.ListView.Items)
{
for (int i = 0; i < itemRow.SubItems.Count; i++)
{
// Do something useful here !
// e.g 'itemRow.SubItems[count]' <-- Should give you direct access to
// the item located at co-ordinates(0,0). Once you got it, do something
// with it.
}
}

Peter Milchev
Telerik team
 answered on 22 Jul 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?