Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
76 views
I am working on an Import User function, which allows multiple users created for our application at one time (in Active Directory)

When the Import button is triggered using an Ajax call, the grid is processed during the postback, the values are retrieved from the grid, and a collection of user objects is passed to a WCF service.

While that service is processing the collection (anywhere from 1 - 250 users, or potentially more), I would like to be able to notify the user how many users have been imported.

The users are being created in Active Directory which slows down the process.
I'm not sure if the Ajax timed-out, but when I refreshed my grid, half the users showed up, and after a few other refreshes they all showed up.

My problem, is that I do not have a view of what is happening during the import process.  For small batches it would be relatively quick.

But for larger batches, it looks like the Ajax Loading Panel will eventually stop, the grid will be refreshed, even though all the users have not completed being processed (created in Active Directory).

 - How can I accomplish getting either progress synchronously, or asynchronously while the WCF service continues to process the user import request? 

 - And is there an demo, of getting the progress of a WCF service that is processing a collection of objects?
Hristo Valyavicharski
Telerik team
 answered on 04 Nov 2013
4 answers
92 views
I'm using the same code used in the documentation to add items to a RadListBox on the client side.  This is the page:

http://www.telerik.com/help/aspnet-ajax/listbox-client-object-api.html


Here is my ASPX:

<telerik:RadListBox ID="lstItems" Width="298" Height="495" runat="server" OnClientSelectedIndexChanging="changingItem">
</telerik:RadListBox>

And here is my JavaScript:
$find(pnlItemsId).expand();
    var cboItems = $find(cboIntelligentSearchId).get_items();
    var lstItems = $find(lstItemsId);
    lstItems.trackChanges();
    var ifrContent = $("#ifrContent")[0];
    var currentItemKey;
    if (ifrContent && ifrContent.contentWindow.getCurrentItemKey && typeof ifrContent.contentWindow.getCurrentItemKey == 'function')
    {
        currentItemKey = ifrContent.contentWindow.getCurrentItemKey();
    }
    var listItems = lstItems.get_items();
    listItems.clear();
    for (var i = 0; i < cboItems.get_count(); i++)
    {
        var cboItem = cboItems.getItem(i);
        var itemName = cboItem.get_text();
        var smItemId = cboItem.get_value();
        var item = new Telerik.Web.UI.RadListBoxItem();
        item.set_text(itemName);
        item.set_value(smItemId);
        listItems.add(item);
        if (currentItemKey && currentItemKey == smItemId)
        {
            candidateSelectedNode = item;
            selectedNode = item;
            item.select();
        }
    }
    lstItems.commitChanges();

When the JS finishes, the items appear in the ListBox, but the scrollbar appears as if it has, maybe, three items below the bottom of the ListBox and using the scrollbar shows about three additional items.  However, approximately 100 items were added.  The only way to get them to appear is to click on one of the items and use the down arrow to scroll to the bottom.

I've poked through the documentation as well as JS objects available on the ListBox and I've found no solution to the problem.  Thanks in advance for your help.
Kate
Telerik team
 answered on 04 Nov 2013
6 answers
238 views
Since updating to the latest version of Telerik I have noticed a few layout issues and wanted to check whether its intentional or whether there is an issue with my app.

On the first screenshot I am referencing the header context menu.

On the second screenshot I am referencing the fields all clumped together.

Please see the attached screenshots.
Daniel
Telerik team
 answered on 04 Nov 2013
2 answers
93 views
Hi Team,

I have a data containing more than 7000 rows. When I bind this data to treelist it takes more than 10 minutes to display on screen. So I implemented AllowLoadOnDemand feature. But when I used AllowLoadOnDemand then ExpandAllItems and AllowRecursiveSelection are not working properly.
I am facing below issues.

1. ExpandAllItems is not expanding to all levels.
2. If AllowRecursiveSelection is set to true, header check is not checked even if I click on header checkbox.

Can you please help me on this where I can use below features of TreeList
1. AllowLoadOnDemand = true with checkbox
2. ExpandAllitems
3. AllowRecursiveSelection
4. Improve Rendring of Treelist with more than 7000 rows

Please reply on this ASAP
Alok
Maria Ilieva
Telerik team
 answered on 04 Nov 2013
1 answer
247 views
I have an ASP.NET user control "Upload.ascx" that contains a RadUpload control that I am using on a page in Sitefinity. Whenever I select a file to upload and submit the form, the ProgressArea appears, but the progress bar does not update, and the remaining time is a really huge number. Then the page posts back, resulting the the progress of the upload never being shown (it stays at 0%, even for large files). I searched around and found some similar issues online, but none of the solutions fixed my problem. I tried switching to a RadAsyncUpload control and changing my web.config runAllManagedModulesForAllRequests value to "true", but neither worked. I also tried a Telerik sample project with a RadUpload control that I found in another support thread, but that also displayed the same issue (but it works on the example page in the Telerik documentation). Might this be an issue with my DLL? I am using Telerik.Web.UI v2012.1.215.40 (Runtime v4.0.30319).

Thanks in advance for any assistance you can offer!

ASCX:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Upload.ascx.cs" Inherits="WebComponents.UserControls.CommonControls.Upload.Upload.Upload" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<script type="text/javascript">
    function ValidatePhoneNumber(sender, args) {
        if (document.getElementById('<%= txtPhonePartOne.ClientID %>').value.length < 1 || document.getElementById('<%= txtPhonePartTwo.ClientID %>').value.length < 1 || document.getElementById('<%= txtPhonePartThree.ClientID %>').value.length < 1) {
            args.IsValid = false;
        }
    }
    //auto move cursor through phone fields
    function checkLen(fieldToMeasure, fieldToJump) {
        var currentLength = document.getElementById(fieldToMeasure).value.length;
        if (currentLength == 3) { document.getElementById(fieldToJump).focus() }
    }
    //client side validation for phone number
    function checkPhone(sender, args) {
        if (document.getElementById('<%= txtPhonePartOne.ClientID %>').value.length < 1 || document.getElementById('<%= txtPhonePartTwo.ClientID %>').value.length < 1 || document.getElementById('<%= txtPhonePartThree.ClientID %>').value.length < 1) {
            args.IsValid = false;
        }
    }
    //validate valid file type
    function ValidateRadUpload1(source, arguments) {
        arguments.IsValid = getRadUpload('<%= radUpload.ClientID %>').validateExtensions();
    }
    //update label for upload
    function updateUploadLabel(fieldToUpdate, textToDisplay) {
        var pageIsValid = Page_ClientValidate();
        if (pageIsValid) {
            document.getElementById(fieldToUpdate).innerHTML = textToDisplay;
        }
    }
</script>
<asp:Label ID="lblErrorMessage" runat="server"></asp:Label>
<asp:ValidationSummary ID="vsForm" runat="server" CssClass="errorsummary" />
<fieldset class="radContainer">
    <legend>
        <asp:Literal ID="litDocumentUploadHeader" runat="server" Text="<%$ Resources:litDocumentHeader %>"></asp:Literal></legend>
    <p>
        <asp:Literal ID="litAllowedFileTypes" runat="server" Text="" /></p>
    <div class="input">
        <label for="ddlInquiryType">
            <asp:Literal ID="litDocumentType" runat="server" Text="<%$ Resources:litDocumentType %>"></asp:Literal>
        </label>
        <asp:DropDownList ID="ddlDocumentType" CssClass="first" runat="server" AppendDataBoundItems="true">
        </asp:DropDownList>
        <asp:RequiredFieldValidator ID="reqDocumentType" ErrorMessage="<%$ Resources:reqDocumentType %>"
            ControlToValidate="ddlDocumentType" Display="Dynamic" runat="server" Text="*"
            CssClass="errorindicator"></asp:RequiredFieldValidator>
    </div>
    <br class="end" />
    <div class="file">
        <asp:Literal ID="litUpload" runat="server" Text="<%$ Resources:litUpload %>" /><br />
        <telerik:RadUpload ID="radUpload" runat="server" InputSize="45" Width="500px" Skin="Test"
            EnableEmbeddedSkins="false" />
        <asp:CustomValidator runat="server" Display="none" CssClass="errorindicator" ID="cusFileType"
            ClientValidationFunction="ValidateRadUpload" OnServerValidate="radUploadCustomValidator_ServerValidate"
            ErrorMessage="<%$ Resources:cusFileType %>" />
    </div>
    <div>
        <asp:Label ID="lblNoResults" runat="server" Visible="True" CssClass="transferMessage" />
        <telerik:RadProgressManager ID="radProgressManager" runat="server" />
        <telerik:RadProgressArea runat="server" ID="ProgressArea1" DisplayCancelButton="True"
            ProgressIndicators="TotalProgressBar, TotalProgress, RequestSize, FilesCountBar, FilesCount, SelectedFilesCount, CurrentFileName, TimeElapsed, TimeEstimated, TransferSpeed"
            Skin="Default" EnableEmbeddedSkins="true">
            <Localization Uploaded="Uploaded" />
        </telerik:RadProgressArea>
    </div>
</fieldset>
<div class="input comment">
    <asp:Literal ID="litComments" runat="server" Text="<%$ Resources:litComments %>"></asp:Literal>
    <asp:RegularExpressionValidator ID="regexComments" runat="server" CssClass="errorindicator"
        ControlToValidate="txtComments" Text="*" Display="Dynamic" EnableClientScript="false"
        ErrorMessage="<%$ Resources:regexComments %>" ValidationExpression="^.[\s\S]{1,10000}$"></asp:RegularExpressionValidator>
    <asp:TextBox ID="txtComments" runat="server" TextMode="MultiLine" MaxLength="10000" />
</div>
<div class="end">
</div>
<div id="divSubmit">
    <asp:Button ID="btnSubmit" runat="server" Text="<%$ Resources:btnSubmit %>" OnClick="btnSubmit_Click" />
</div>

ASCX.CS:
using InstalledWebComponents.Library.Email;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Telerik.Sitefinity.GenericContent.Model;
using Telerik.Sitefinity.Lists.Model;
using Telerik.Sitefinity.Modules.Lists;
using Telerik.Sitefinity.Workflow;
using Telerik.Web.UI;
 
namespace WebComponents.UserControls.CommonControls.Upload.Upload
{
    public partial class Upload : System.Web.UI.UserControl
    {
        private const string LIST_NAME = "Upload Document Types";
        Regex regEx = new Regex(@"^([\(]{1}[0-9]{3}[\)]{1}[\.| |\-]{0,1}|^[0-9]{3}[\.|\-| ]?)?[0-9]{3}(\.|\-| )?[0-9]{4}$");
        private string _onCompletionRedirectUrl;
        private string ldc = string.Empty;
 
        [Personalizable(PersonalizationScope.Shared), WebBrowsable(), WebDisplayName("On completion redirect user to this page"), WebDescription("On completion redirect user to this page")]
        [System.ComponentModel.Description("On completion redirect user to this page.")]
        public string OnCompletionRedirectUrl
        {
            get
            {
                if (string.IsNullOrEmpty(_onCompletionRedirectUrl))
                    _onCompletionRedirectUrl = "~/thankyou";
 
                return _onCompletionRedirectUrl;
            }
            set { _onCompletionRedirectUrl = value; }
        }
 
        protected void Page_Init(object sender, EventArgs e)
        {
            BindInquiryTypes();
        }
         
        protected void Page_Load(object sender, EventArgs e)
        {
            txtPhonePartOne.Attributes.Add("onKeyUp", string.Format("checkLen('{0}','{1}')", txtPhonePartOne.ClientID, txtPhonePartTwo.ClientID));
            txtPhonePartTwo.Attributes.Add("onKeyUp", string.Format("checkLen('{0}','{1}')", txtPhonePartTwo.ClientID, txtPhonePartThree.ClientID));
 
            SetObjectsVisibility();
 
            string domain = Request.Url.Host.ToUpperInvariant();
        }
         
        protected void validatePhoneNumber_ServerValidate(object source, ServerValidateEventArgs args)
        {
            string phoneNumber = EmailForm.CombinePhoneNumberParts(txtPhonePartOne.Text, txtPhonePartTwo.Text, txtPhonePartThree.Text);
            if (phoneNumber.Length > 0)
            {
                args.IsValid = regEx.Match(phoneNumber).Success;
            }
        }
         
        private void BindInquiryTypes()
        {
            ddlDocumentType.Items.Clear();
            List<Telerik.Sitefinity.Lists.Model.ListItem> list = EmailForm.GetList(LIST_NAME).ListItems.ToList();
            List<string> itemList = new List<string>();
            itemList.Add("Select Document Type");
            for (int index = 0; index < list.Count; index++)
            {
                if (!itemList.Contains(list[index].Title))
                {
                    itemList.Add(list[index].Title);
                }
            }
            ddlDocumentType.DataSource = itemList;
            ddlDocumentType.DataBind();
        }
 
        private void SetObjectsVisibility()
        {
            string strAllowedFileType = EmailForm.FindListItem(EmailForm.GetList("Upload Document Allowed File Types"), "allowed file types").Content.ToString();
            string[] arrAllowedFileTypes = strAllowedFileType.Split(new char[] { ',' });
 
            radUpload.ControlObjectsVisibility = ControlObjectsVisibility.None;
            radUpload.ControlObjectsVisibility |= ControlObjectsVisibility.AddButton;
            radUpload.ControlObjectsVisibility |= ControlObjectsVisibility.RemoveButtons;
            radUpload.MaxFileInputsCount = 5;
            radUpload.MaxFileSize = 524288000; //500MB
            radUpload.AllowedFileExtensions = arrAllowedFileTypes;
            radUpload.Localization.Add = GetLocalResourceObject("RadUploadAddButtonText").ToString();
 
            litAllowedFileTypes.Text = strAllowedFileType;
        }
 
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid) return;
 
            if (txtPhonePartOne.Text.Length < 3 || txtPhonePartTwo.Text.Length < 3 || txtPhonePartThree.Text.Length < 4)
            {
                lblErrorMessage.Text = "Phone Number is not valid";
                return;
            }
 
            SendEmail();
            ShowResults();
 
            if (lblErrorMessage.Text.Length == 0)
                Response.Redirect(OnCompletionRedirectUrl);
        }
 
        private void ShowResults()
        {
            //load results into session variable
            //todo create session handling class
            ArrayList arlUploadedFiles = new ArrayList();
            ArrayList arlInvalidFiles = new ArrayList();
            if (radUpload.UploadedFiles.Count > 0)
            {
                foreach (UploadedFile file in radUpload.UploadedFiles)
                {
                    arlUploadedFiles.Add(file.FileName.ToString());
                }
                Session["SuccessfullyUploadedFiles"] = arlUploadedFiles;
            }
 
            if (radUpload.InvalidFiles.Count > 0)
            {
 
                foreach (UploadedFile invalidfile in radUpload.InvalidFiles)
                {
                    arlInvalidFiles.Add(invalidfile.FileName.ToString());
                }
                Session["InvalidFilesRejectedForUpload"] = arlInvalidFiles;
            }
        }
 
        private bool SendEmail()
        {
            //Sends submitted form data and file(s)
            return true;
        }
 
        private string BuildEmailBody()
        {
            //Builds email body and returns string
            return "Email body content"
        }
 
        protected void radUploadCustomValidator_ServerValidate(object source, ServerValidateEventArgs eventArgs)
        {
            eventArgs.IsValid = (radUpload.InvalidFiles.Count == 0);
        }
    }
}

Peter Filipov
Telerik team
 answered on 04 Nov 2013
1 answer
79 views
Hi. I have a telrik grid like below. I created it dynamically both header and datas. All of them was created in code behind. Now, I try to export grid to word or excel.

Name                 Surname                              Info

                                                        Date                   Number
------------------------------------------------------------------------------
John                  White                     4.4.2011                  45
Tracey              Dapt                       5.4.2011                  70    

I export a grid like seen above. It worked . But headers Name and Surname does not been shown in word document.  Why can this happen. Can someone give me an idea?
Thanks in advance..







Kostadin
Telerik team
 answered on 04 Nov 2013
1 answer
48 views
Is It possible to display all palettes and have the RGBSliders be the first and default palette?
Slav
Telerik team
 answered on 04 Nov 2013
1 answer
154 views
Hi,

I am getting problem in rebind radgrid on radwindow close because i have to rebind 3 grid on parent page. It is rebinding just last grid which i have mentioned in code.
 
Following code i have used in my code

///------ In radwindow javascript code -------
 function clientClose(arg) {
                getRadWindow().close(arg);
                var oWin = getRadWindow();
                var parentWindow = oWin.BrowserWindow;
                // top.location.href = top.location.href;
                parentWindow.refreshGrid();
            }

/// ---------In parent page javascirpt code -----
        function refreshGrid() {
                var masterTable1 = $find("<%=rgDefinition.ClientID%>").get_masterTableView();
                var masterTable2 = $find("<%=rgDevelopment.ClientID%>").get_masterTableView();
                  var masterTable3 = $find("<%=rgTesting.ClientID%>").get_masterTableView();
               masterTable1.rebind();
               masterTable2.rebind();
               masterTable3.rebind();
            }
      
Problem is that ----   this code rebinding my last grid means masterTable3.rebind(); because it is in the last of code.
Konstantin Dikov
Telerik team
 answered on 04 Nov 2013
1 answer
45 views
I want to do something similar to the left control of screen of the demos page (the control say "All controls" and when is clicked look a green box with all the controls and theirs demos). Sorry for my bad english I speak spanish.
http://demos.telerik.com/aspnet-ajax/
Venelin
Telerik team
 answered on 04 Nov 2013
1 answer
101 views
Hi,
 I am having a hierarchy radgrid of two level. I wanted a header button near to the column headers, where clicking on it expands all the rows. How to achieve this. Anyone can provide me with a sample.?
 
Thankyou.
Dawson
Princy
Top achievements
Rank 2
 answered on 04 Nov 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?