Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
78 views
I have created a custom skin for my radgrid and have a number of datetime columns with filters.

Is there any way that I can apply my skin to the DatePicker controls that are automatically inserted as the filtering items?

I have tried assigning a SkinID to the filteringitem during the ItemCreated event and get an error telling me that I must make skin assignments during the Page.PreInit event.

Any ideas?

Thanks.

Mike
Iana Tsolova
Telerik team
 answered on 25 Aug 2011
1 answer
112 views
Hi,

I have a RadListBox embedded into a RadDock. When the RadDock is opened (MyRadDock.Closed = false), I want to clear
the RadListBox.
At the moment, when the RadDock is closed and opened again, the ListBox still contains the items from the previous command call.

Unfortunately I don't find an event which is fired when the RadDock is opened. The client-side event "OnClientInitialize" is also called on PostBack but I want to preserve the ListBox content during a PostBack (which currently works fine) when the RadDock is opened.

Do you have any idea how I can clear the RadListBox every time the RadDock is opened but not on a PostBack?

Thanks!

Slav
Telerik team
 answered on 25 Aug 2011
1 answer
98 views
Hi,

I have inserted SPradgrid in one of my sharepoint 2010 page.
After that I integrated sharepoint list with SPradgrid to display list data.

I want to know how should I handle client and server side events in SPRadgrid.

Please share you information.

Thanks,
Nirav.
Maria Ilieva
Telerik team
 answered on 25 Aug 2011
3 answers
681 views
I have a telerik grid with masterdetail view which works fine on dev machine, but on the produciton server gives the following error when trying to click on the + to expand the detail view
Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
Line: 868
Char: 13
Code: 0
URI: http://stg/ScriptResource.axd?d=WPWgUqfqWNOKwEIK623Rj1atHxx0muHp2TuYIOyTDuZq4iZdR4d8M3a94sBKs28ffLNvQd0IhbwuKOECVhpyU_sPvVPXMieAwhP9vcB-7gyWfNLudOBik1XZsFAl_Mv1J0KWTyMBwF3XMNtAuY91y0fExR5oYve9HYEYEtzdevEvZXV6AydUtwWdBzwQDWCgBPrZ9Q2&t=2610f696


On the source at Line 868,, it is the javascript postback code.

I have noticed that the error is not occuring if I do an enableAjax = "false" on the radajaxmanager.

 IIS runs on the Classic AppPool.

Is there any other place I should be checking on?
Iana Tsolova
Telerik team
 answered on 25 Aug 2011
1 answer
138 views
Hello,

I have build an uploadcontrol. The user can upload files and can view the uploaded file. For this I use the RadFileExplorer. Everything is working fine except deleting files. When I change a folder the addressbar is updated fine. But when I want to delete an image in the FileExplorer, the file is not deleted because the CurrentFolder-property in the codebehind is not updated to the path of the folder I selected. When I fire the event for the second time it works well because the CurrentFolder-property is updated this time. So, it looks I'm walking one postback behind.

Can anyone tell me what I'm doing wrong. Thx

<head runat="server">
    <title>UploadManager voor productafbeeldingen</title>
    <link href="CSI/css/custom/admin.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/Slider.UIN.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/ComboBox.UIN.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/Calendar.UIN.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/Input.UIN.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/TreeView.UIN.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/Upload.UIN.css" rel="stylesheet" type="text/css" />
    <link href="CSI/CSS/telerik/FileExplorer.UIN.css" rel="stylesheet" type="text/css" />
    <script src="CSI/JS/3rdparty/flash_detect.js" type="text/javascript"></script>
    <script src="CSI/JS/jQuery/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script src="CSI/JS/jQuery/jquery-1.2.6.min.js" type="text/javascript"></script>
    <script src="CSI/JS/telerik/IntegrationScripts.js" type="text/javascript"></script>
    <telerik:RadCodeBlock ID="codeBlock1" runat="server">
        <script type="text/javascript">
            //<![CDATA[           
 
            function OnClientDirectoryChange(sender, args) {
                alert("Tree dir change: " + args.get_path());
            }
            
            function OnClientItemClick(sender, args) {
                alert("Item click: " + args.get_path());
            }          
 
            //]]>
        </script>
    </telerik:RadCodeBlock>
    </head>
<body>
    <form runat="server" id="mainForm" method="post">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
    <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" />
    <div class="productimagemanager">
        <div class="qualitycenter">
            <div class="fileexplorer">
                <table cellspacing="4">
                    <tr>
                        <td rowspan="2" style="vertical-align: top;">                          
                            <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="700px" Height="500px" Skin="UIN" EnableOpenFile="true"
                                OnClientLoad="OnFileExplorerLoad" OnClientFolderChange="OnClientDirectoryChange">
                                <Configuration ViewPaths="~/media/QualityCenter/forapproval/retailer65" DeletePaths="~/media/QualityCenter/forapproval/retailer65" UploadPaths="~/media/QualityCenter/forapproval/retailer65" />
                            </telerik:RadFileExplorer>
                        </td>
                    </tr>
                </table>
            </div>
            <asp:Panel ID="ListViewHolder" runat="server">
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server">
                </telerik:RadAjaxLoadingPanel>
                <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server" OnServiceRequest="RadXmlHttpPanel1_ServiceRequest" RenderMode="Block" EnableClientScriptEvaluation="true"
                    LoadingPanelID="RadAjaxLoadingPanel" OnClientResponseEnded="OnClientResponseEnded">
                    <telerik:RadContextMenu ID="RadListViewContextMenu" runat="server" OnClientItemClicked="RadListViewMenuItemClicked">
                    </telerik:RadContextMenu>
                    <telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="ItemPlaceHolder1" AllowPaging="true" AllowCustomPaging="true" PageSize="6"
                        OnItemDataBound="RadListView1_ItemDataBound" OnItemCommand="RadListView1_ItemCommand">
                        <LayoutTemplate>
                            <div class="imagelibrary">
                                <div class="actiebuttons">
                                    <asp:ImageButton ID="btnSaveNewImageNames" runat="server" ImageUrl="~/App_Themes/UIN/Layout/buttons/opslaanensluitenbutton.png" Width="194px"
                                        Height="30px" ToolTip="Opslaan artikel en artikelwizard afsluiten" CommandName="updatefilenames" Visible="false" />
                                </div>
                                <asp:PlaceHolder ID="ItemPlaceHolder1" runat="server"></asp:PlaceHolder>
                            </div>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <asp:Panel ID="itemTemplateHolder" runat="server" CssClass="lvItemTemplate" ondblclick="openImageForPreview(this);" onclick="imageSelected(this);">
                                <div class="imageitem">
                                    <div class="imagefile">
                                        <asp:Image ID="imgImageFile" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "Path") %>' AlternateText="Image" CssClass="imagefile" />
                                        <asp:ImageButton ID="imgDeleteFile" runat="server" ImageUrl="~/App_Themes//UIN//Layout//buttonDeleteImage.png" CssClass="deleteimage" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Path") %>'
                                            OnClick="imgDeleteFile_Click" OnClientClick="return confirm('Weet u zeker dat u deze afbeelding wilt verwijderen?');" />
                                        <input type="hidden" value="<%# GetFileItemProperties(Container.DataItem) %>" />
                                    </div>
                                    <div class="imageoldname">
                                        <asp:Label ID="lblImageOldNameLabel" runat="server" Text="Huidige bestandsnaam" CssClass="labelheader"></asp:Label>
                                        <asp:Label ID="lblImageOldName" runat="server" CssClass="imagenamelabel" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label></div>
                                    <div class="imagenewname">
                                        <asp:Label ID="lblImageNewName" runat="server" Text="Nieuwe naam" CssClass="labelheader"></asp:Label>
                                        <asp:TextBox ID="txtImageNewName" runat="server">
                                        </asp:TextBox></div>
                                </div>
                            </asp:Panel>
                        </ItemTemplate>
                    </telerik:RadListView>                   
                </telerik:RadXmlHttpPanel>
            </asp:Panel>
        </div>
    </div>   
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
 
            function loadListViewContent(pathToFolder, sliderIndex) {
                var pageIndexChangeArg = pathToFolder + "$|$" + sliderIndex;
                var oXmlPanel = $find("<%= RadXmlHttpPanel1.ClientID %>");
                selectedListViewItems = []; // Clear selection
                oXmlPanel.set_value(pageIndexChangeArg);
            }
 
            function getRadFileExplorer1() {// returns RadFileExplorer1 client-side object
                var oExplorer = $find("<%= RadFileExplorer1.ClientID %>");
                return oExplorer;
            }
            
        </script>
    </telerik:RadCodeBlock>
    </form>
</body>
</html>
protected void Page_Load(object sender, System.EventArgs e)
    {
        RadFileExplorer1.VisibleControls = Telerik.Web.UI.FileExplorer.FileExplorerControls.ContextMenus |
                                                Telerik.Web.UI.FileExplorer.FileExplorerControls.TreeView|
                                                Telerik.Web.UI.FileExplorer.FileExplorerControls.AddressBox;
 
        //set properties according to configuration panel
        RadFileExplorer1.Configuration.SearchPatterns = new string[] { "*.jpg", "*.jpeg" };      
        RadFileExplorer1.EnableOpenFile = false;
        RadFileExplorer1.DisplayUpFolderItem = true;
        RadFileExplorer1.AllowPaging = false;
        RadFileExplorer1.EnableCreateNewFolder = false;
         
        RadFileExplorer1.FindControl("paneTree").Controls.Add(ListViewHolder);
 
        if (!Page.IsPostBack)
        {
            BindCollections();
            txtArchiveName.Text = DateTime.Today.ToShortDateString();
 
            if (!string.IsNullOrEmpty(RadFileExplorer1.InitialPath))
            {
                bool isDirectory = VirtualPathUtility.GetExtension(RadFileExplorer1.InitialPath) == string.Empty;
                if (isDirectory)
                {// The InitialPath points to a file
                    // Get the directory:
                    string parentDirectory = VirtualPathUtility.GetDirectory(RadFileExplorer1.InitialPath);
                    LoadListViewData(0, parentDirectory);
                }
                else
                {// The InitialPath contains a directory path
                    string parentDirectory = RadFileExplorer1.InitialPath;
                    LoadListViewData(0, parentDirectory);
                }
            }
            else
            {// The InitialPath property is not set ==> load the first folder in the ViewPaths property
                string targetFolder = RadFileExplorer1.Configuration.ViewPaths[0] + "/" + cboCollection.Items[0].Text.Replace(" ", "_"); // +"/" + txtArchiveName.Text;
 
                string parentDirectory = targetFolder; // RadFileExplorer1.Configuration.ViewPaths[0];               
                LoadListViewData(0, parentDirectory);
            }                    
        }
        else
        {
            Control postbackControl = GetPostBackControl(this);// get the control that is coused the post back ;          
 
            if (postbackControl != null && postbackControl.ID == "buttonSubmit")
            {
                RadFileExplorer1.TreeView.Nodes.Clear();
                TargetFolder = "~/" + RETAILER_IMAGEPATH + FILIAAL_ID + "/" + cboCollection.Items[0].Text + "/" + txtArchiveName.Text;               
                RadFileExplorer1.InitialPath = Page.ResolveUrl(TargetFolder);               
            }                       
        }
 
        //RemoveBackForwardRefreshButtons();
    }
 
protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
 
        if (IsPostBack)
        {// This code ensures that the RadListView's content will be refreshed when a new file is uploaded
            string parentDirectory = RadFileExplorer1.CurrentFolder;
            LoadListViewData(0, parentDirectory);
        }
    }
 
protected void imgDeleteFile_Click(object sender, ImageClickEventArgs e)
    {
        File.Delete(Server.MapPath(((ImageButton)sender).CommandArgument));
    }
 
    protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e)
    {// This event is used in order to associate the 'RadListViewContextMenu' with every itemTemplateHolder panes in the RadListView
        Telerik.Web.UI.RadListViewDataItem lvitem = (Telerik.Web.UI.RadListViewDataItem)e.Item;
        ContextMenuElementTarget elementTarget = new ContextMenuElementTarget();
        Control paneControl = e.Item.FindControl("itemTemplateHolder");
        RadBinaryImage oImage = e.Item.FindControl("imgImageFile") as RadBinaryImage;
        ImageButton oDeleteImage = e.Item.FindControl("imgDeleteFile") as ImageButton;
        elementTarget.ElementID = paneControl.ClientID;
        RadListViewContextMenu.Targets.Add(elementTarget);
    }
 
    protected void RadListView1_ItemCommand(object sender, RadListViewCommandEventArgs e)
    {
        if (e.CommandName == "updatefilenames")
        {
            foreach (RadListViewDataItem item in RadListView1.Items)
            {
                TextBox oNewImageName = item.FindControl("txtImageNewName") as TextBox;
                Label oOldImageName = item.FindControl("lblImageOldName") as Label;
                Image oImage = item.FindControl("imgImageFile") as Image;
                string path = RadFileExplorer1.CurrentFolder;
 
                if (oOldImageName != null && oNewImageName != null)
                {
                    if (oNewImageName.Text != string.Empty)
                    {
                        string updatePath = oImage.ImageUrl.Replace(oOldImageName.Text, oNewImageName.Text + ".jpg");
                        File.Move(Server.MapPath(oImage.ImageUrl), Server.MapPath(updatePath));
                    }
                }              
            }
 
            LoadListViewData(0, RadFileExplorer1.CurrentFolder);
        }
    }
 
    protected void RadXmlHttpPanel1_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)
    {// The value of e.Value looks like this: '/ListViewIntegration/FileExplorer/ExplorerSource/Images/Customers$|$0'
        string[] arguments = e.Value.Split(new string[] { "$|$" }, StringSplitOptions.RemoveEmptyEntries);
        string pathToFolder = arguments[0];
        string sliderValue = arguments[1];
        int sliderIndexAsInt = int.Parse(sliderValue);
        LoadListViewData(sliderIndexAsInt, pathToFolder);
    }
 
 private void LoadListViewData(int sliderIndex, string pathToFolderForLoad)
    {
        List<FileItem> allFilesInFolder = GetFilesSorted(pathToFolderForLoad);
 
        if (allFilesInFolder.Count.Equals(0))
        {// No files in directory
 
            //RadSlider1.Enabled = false;// Disable slider (or hide it (RadSlider1.Visible = false))
            RadListView1.DataSource = null;
            RadListView1.DataBind();// Clear content
            ((ImageButton)RadListView1.FindControl("btnSaveNewImageNames")).Visible = false;
        }
        else
        {
            //RadSlider1.Enabled = true;// Enable RadeSlider
 
            // Starting index
            int fromIndex = sliderIndex * RadListView1.PageSize;
 
            // Calculate the count of the images
            int count = (fromIndex + RadListView1.PageSize) < allFilesInFolder.Count ? RadListView1.PageSize : allFilesInFolder.Count - fromIndex;
 
            // Get maximum 4 files at a time
            List<FileItem> listViewSource = allFilesInFolder.GetRange(fromIndex, count);
            RadListView1.DataSource = listViewSource;
            RadListView1.DataBind();
            ((ImageButton)RadListView1.FindControl("btnSaveNewImageNames")).Visible = true;
 
             
            long outLong = new long();// USed in order to be compliant with the VB.NET version
            // Refresh slire's values
            //RadSlider1.MaximumValue = (allFilesInFolder.Count % RadListView1.PageSize).Equals(0) ? Math.DivRem(allFilesInFolder.Count, RadListView1.PageSize, out outLong) - 1 : Math.DivRem(allFilesInFolder.Count, RadListView1.PageSize, out outLong);
            //RadSlider1.Value = sliderIndex;
 
            // Checks permissions and associates a context menu with all images in the ListView
            CreateListContextMenu(pathToFolderForLoad);
        }
    }
 
 private void CreateListContextMenu(string pathToOpenedFolder)
    {
        RadTreeViewContextMenu treeContextMenu = RadFileExplorer1.TreeView.ContextMenus[0];
        RadListViewContextMenu.Items.Clear();
        foreach (RadMenuItem treeMenuItem in treeContextMenu.Items)
        {
            RadMenuItem clonedTreeMenuItem = treeMenuItem.Clone();
            switch (clonedTreeMenuItem.Value)
            {
                case "Delete":
                    {
                        bool enableCommand = ContentProvider.CheckDeletePermissions(pathToOpenedFolder);
                        if (enableCommand)
                        {// The path has Delete permisson ==> Delete is allowed
                            RadListViewContextMenu.Items.Add(clonedTreeMenuItem);
                        }
                    } break;
                case "Upload":
                    {
                        bool enableCommand = ContentProvider.CheckWritePermissions(pathToOpenedFolder);
                        if (enableCommand)
                        {// The path has Write permisson ==> upload is allowed
                            RadListViewContextMenu.Items.Add(clonedTreeMenuItem);
                        }
                    } break;
            }
        }
 
        if (RadFileExplorer1.EnableOpenFile)
        {
            RadMenuItem openFileItem = new RadMenuItem();
            openFileItem.Value = "Open";
            openFileItem.Text = "Open";
            openFileItem.PostBack = false;
            openFileItem.EnableViewState = false;
            openFileItem.SelectedCssClass = "rfeNoClass";
            RadListViewContextMenu.Items.Add(openFileItem);
        }
 
        RadListViewContextMenu.Skin = RadFileExplorer1.Skin;
    }
 
    /// <summary>
    /// Returns an instance of FileBrowserContentProvider asociated with RadFileExplorer control. If a cusom provider is used, then this propperty should return
    /// an instance of that cusom provider.
    /// </summary>
    private FileBrowserContentProvider ContentProvider
    {
        get
        {
            if (object.Equals(this._contentProvider, null))
            {
 
                this._contentProvider = new FileSystemContentProvider(this.Context,
                                                                             RadFileExplorer1.Configuration.SearchPatterns,
                                                                             RadFileExplorer1.Configuration.ViewPaths,
                                                                             RadFileExplorer1.Configuration.UploadPaths,
                                                                             RadFileExplorer1.Configuration.DeletePaths,
                                                                             string.Empty,
                   
            }
 
            return this._contentProvider;
        }
    }
Dobromir
Telerik team
 answered on 25 Aug 2011
5 answers
89 views
Hello,

Iam using RadGrid for listing some data grom DB... I need change some values on client using your API. I am using this code:
<telerik:RadScriptBlock>
            <script type="text/javascript">
                 var mySelectedGrid;
                var mySelectedGrid_MasterTableView;
 
                function GetGridObject(sender, eventArgs) {
                     var _mySelectedGrid = sender;
                    mySelectedGrid = $find(_mySelectedGrid.ClientID);
                    mySelectedGrid_MasterTableView = mySelectedGrid.get_masterTableView();
                 }
             </script>
        </telerik:RadScriptBlock>

If I debugging page in Firefox Firebug tool i cant see Rows in Mater table view. "mySelectedGrid.MasterTableView.Rows" writing "undefined". I was trying this on several of our projects and have some results.

Please, can you help me to find where is problem?
Pavlina
Telerik team
 answered on 25 Aug 2011
5 answers
175 views
Hello,

I'm building a multi language (RTL  and LTR) webpage which uses a RadEditor control.
I'm using the following RTL control:
<telerik:RadEditor runat="server" ID="RadEditor1" Height="350px"
                            DialogsCssFile="./RTL/RadEditor_Dialogs_RTL.css" ContentAreaCssFile="./RTL/EditorContentArea_RTL.css">
                            <Modules>
     <telerik:EditorModule Visible="false" />
                            </Modules>
                        </telerik:RadEditor>

But the problem is when changing the language to LTR, the RadEditor is still behave in RTL mode because of the following attributes:
DialogsCssFile
ContentAreaCssFile

What I shoud do?

Please, I need your help,
It is very appreciated to send me the modified code.

Regards,
Bader
Rumen
Telerik team
 answered on 25 Aug 2011
2 answers
61 views
While using RadUpload control on RadGrid Edit Popup, and clicking Select button of RadUpload control, it's not working for IE9 and FireFix 4 Beta (OpenFileDialog is not shown) but it works properly for Safari and Chrome.
I using that the following Telerik Version 2009.3.1103.35.

The following code represents EditFormSettings 

<EditFormSettings EditFormType="WebUserControl" UserControlName="StudentDependent.ascx" InsertCaption="Add new dependent">
  <PopUpSettings Modal="true" ScrollBars="Auto" />
</EditFormSettings>


Any ideas?
Galin
Telerik team
 answered on 25 Aug 2011
1 answer
114 views
I have an application which uses the Telerik RADUpload control. I have made all the Telerik suggested changes to the web.config file to enable and allow large file uploads.

I can upload 42 photos (approx 1.5MB each) from my laptop in IE9 and Google Chrome. However, our users who have HTC Thunderbolts running Android cannot. If they load 15+ photos of the same size, the application immediately exits and returns the user to the home screen of the phone.

Is this a limitation of Telerik controls being used on mobile devices, especially Android devices?

Thank you.
Peter Filipov
Telerik team
 answered on 25 Aug 2011
1 answer
65 views
I have an application which uses the Telerik RADUpload control. I have made all the Telerik suggested changes to the web.config file to enable and allow large file uploads.

I can upload 42 photos (approx 1.5MB each) from my laptop in IE9 and Google Chrome. However, our users who have HTC Thunderbolts running Android cannot. If they load 15+ photos of the same size, the application immediately exits and returns the user to the home screen of the phone.

Is this a limitation of Telerik controls being used on mobile devices, especially Android devices?

Thank you.
Peter Filipov
Telerik team
 answered on 25 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?