RadAjaxLoadingPanel not showing when I add RadUpload to grid

6 posts, 0 answers
  1. darenkov
    darenkov avatar
    20 posts
    Member since:
    Mar 2007

    Posted 07 Oct 2009 Link to this post

    I have a functional RadGrid with an RadUpload control in the editTemplate. I am also using a RadAjaxManager in which the Grid references itself. For some reason, the LoadingPanel doesn't display (even though I have set the panel in the RadAjaxManager). The loading panel worked fine until I added in the upload control and javascript conditionalPostback code. I've even tried adding a button and label to print some text and although it ajaxifies it still doesn't display the loader (and it's not because of the image).

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="gridupload.aspx.cs" Inherits="admin_gridupload" %> 
     
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head id="Head1" runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
                <telerik:radscriptblock id="RadScriptBlock1" runat="server"
                    <script type="text/javascript"
                        //On insert and update buttons click temporarily disables ajax to perform upload actions                     
                        function conditionalPostback(e, sender) { 
                            var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig"); 
                             
                            if (sender.EventTarget.match(theRegexp)) { 
                                var upload = $find(window['UploadId']); 
     
                                //AJAX is disabled only if file is selected for upload 
                                if (upload.getFileInputs()[0].value != "") { 
                                    sender.EnableAjax = false
                                } 
                            } 
                        }     
                    </script> 
                </telerik:radscriptblock> 
                 
                <telerik:RadAjaxManager ID="AjaxManager1" runat="server"
                <ClientEvents OnRequestStart="conditionalPostback"/> 
                <AjaxSettings>         
                    <telerik:AjaxSetting AjaxControlID="RadGrid1"
                        <UpdatedControls > 
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting>           
                </AjaxSettings>          
                </telerik:RadAjaxManager> 
        <div> 
         
                 
                <telerik:RadProgressManager ID="RadProgressManager1" Runat="server" /> 
        <telerik:RadProgressArea ID="RadProgressArea1" Runat="server"
        </telerik:RadProgressArea> 
            <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="odsVideo"  
                GridLines="None" AutoGenerateColumns="False"  
                oninsertcommand="RadGrid1_InsertCommand"
    <MasterTableView  
        CommandItemDisplay="Top"  
        DataKeyNames="VideoID"  
        EditMode="EditForms" 
        DataSourceID="odsVideo"
        <EditItemTemplate> 
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
        </EditItemTemplate> 
    <RowIndicatorColumn> 
    <HeaderStyle Width="20px"></HeaderStyle> 
    </RowIndicatorColumn> 
     
    <ExpandCollapseColumn> 
    <HeaderStyle Width="20px"></HeaderStyle> 
    </ExpandCollapseColumn> 
        <Columns> 
            <telerik:GridEditCommandColumn> 
            </telerik:GridEditCommandColumn> 
            <telerik:GridBoundColumn DataField="VideoID" DataType="System.Int32"  
                HeaderText="VideoID" ReadOnly="True" SortExpression="VideoID"  
                UniqueName="VideoID"
            </telerik:GridBoundColumn> 
            <telerik:GridTemplateColumn DataField="Title" HeaderText="Title"  
                SortExpression="Title" UniqueName="Title"
                <EditItemTemplate> 
                    <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox> 
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>'></asp:Label> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
            <telerik:GridTemplateColumn DataField="FileName" DataType="System.Guid"  
                HeaderText="FileName" SortExpression="FileName" UniqueName="FileName"
                <EditItemTemplate> 
                    <telerik:RadUpload ID="RadUpload1" Runat="server"
                    </telerik:RadUpload>  
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="FileNameLabel" runat="server" Text='<%# Eval("FileName") %>'></asp:Label> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
            <telerik:GridBoundColumn DataField="Minutes" DataType="System.Int32"  
                HeaderText="Minutes" SortExpression="Minutes" UniqueName="Minutes"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Seconds" DataType="System.Int32"  
                HeaderText="Seconds" SortExpression="Seconds" UniqueName="Seconds"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="DateAdded" DataType="System.DateTime"  
                HeaderText="DateAdded" SortExpression="DateAdded" UniqueName="DateAdded"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="SeriesID" DataType="System.Int32"  
                HeaderText="SeriesID" SortExpression="SeriesID" UniqueName="SeriesID"  
                Visible="False"
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="Ranking" DataType="System.Int32"  
                HeaderText="Ranking" SortExpression="Ranking" UniqueName="Ranking"  
                Visible="False"
            </telerik:GridBoundColumn> 
            <telerik:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean"  
                HeaderText="IsActive" SortExpression="IsActive" UniqueName="IsActive"
            </telerik:GridCheckBoxColumn> 
        </Columns> 
     
    <EditFormSettings> 
    <EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
    </EditFormSettings> 
    </MasterTableView> 
    </telerik:RadGrid>         
     
        </div> 
        <asp:ObjectDataSource ID="odsVideo" runat="server"  
            DataObjectTypeName="MySample.BusinessObjects.Video"  
            DeleteMethod="Delete" InsertMethod="Insert"  
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetItems"  
            TypeName="MySample.BusinessLogic.VideoManager"  
            UpdateMethod="Update"
            <DeleteParameters> 
                <asp:Parameter Name="videoID" Type="Int32" /> 
            </DeleteParameters> 
        </asp:ObjectDataSource> 
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"
        </telerik:RadScriptManager> 
                 
        <br /> 
        <br />         
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="16px" 
        Transparency="50" Width="16px"
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
            style="border: 0px;" /> 
    </telerik:RadAjaxLoadingPanel> 
        </form> 
    </body> 
    </html> 


  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Oct 2009 Link to this post

    Hello Daren,

    RadUpload cannot upload files using AJAX calls. This is a limitation of the XmlHttpRequest component, used in all AJAX frameworks for asynchronous calls to the application. In order to upload a file your application must perform a full page postback.
    Please find more information in the following links:
    Using RadUpload in an Ajaxified Grid
    Uploading Files with AJAX

    Greetings,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. darenkov
    darenkov avatar
    20 posts
    Member since:
    Mar 2007

    Posted 08 Oct 2009 Link to this post

    Hello, I think you misunderstood my question.

    Everything is working (Ajaxified with upload), except for the loadingpanel.

    Can you look at my code?
  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Oct 2009 Link to this post

    Hello Daren,

    I am sending you a simple working project which handles the desired functionality. Please give it  a try a
    nd let me know if you need additional assistance.

    I hope this helps.

    Kind regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 03 Aug 2011 Link to this post

    This example doesn't seem to work.

    on RadGrid1_ItemCommand

     

     

     if (e.CommandName == RadGrid.UpdateCommandName) has error index was out of range

     I put the following under RadGrid1_ItemCommand: the file count will always be 0 no matter what if use ajaxloadingpanel

     

     

     

    if (e.CommandName == RadGrid.UpdateCommandName)

     

    RadUpload upload = (RadUpload)item.FindControl("RadUpload1");

     

     

    Int32 filenum = upload.UploadedFiles.Count;

     

  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 04 Aug 2011 Link to this post

    Hi,

    I hope that the online example below will help you to resolve the problem you are facing:
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandradasyncupload/defaultcs.aspx?product=grid

    Best wishes,
    Pavlina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017