RadAsync Upload Control firing client event from RADGrid.

2 posts, 0 answers
  1. Chirag.Amin
    Chirag.Amin avatar
    1 posts
    Member since:
    Oct 2011

    Posted 29 Jul 2013 Link to this post

    Hi, I am having problem with firing client side ajax for radAsyncControl within RadGrid.(WithGrid.aspx)  I have RadGrid on page and I have radAsyncControl as part of each row on Grid upload. When I select file and fire client side event "OnClientFilesUploaded", I want to fire a Ajax event that will perform task on server side.

    If I don't use radgrid and put control on directly on page then this event works fine (WithoutGrid.aspx)

    Please find code per page as belows
    WithGrid.aspx
        <title></title>
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
     
            <script type="text/javascript">
     
                function OnClientFilesUploaded(sender, args) {
     
                    $find('<%=RadAjaxManager1.ClientID %>').ajaxRequest();
     
                }
     
            </script>
     
        </telerik:RadScriptBlock>
    </head>
    <body>
        <form id="form1" runat="server">
            <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
            <div>
                <table>
                    <tr>
                        <td style="width: 100%">
                            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="false">
                                <AjaxSettings>
                                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="dgChartList" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                </AjaxSettings>
                            </telerik:RadAjaxManager>
                            <telerik:RadGrid ID="dgChartList" runat="server" AutoGenerateColumns="False"
                                Skin="Vista" AllowSorting="True" AllowPaging="True" PageSize="5" GridLines="Horizontal" BorderColor="#999999" BorderStyle="Solid" CellSpacing="0" >
                                <ClientSettings EnableRowHoverStyle="true">
                                    <Selecting AllowRowSelect="true"></Selecting>
                                </ClientSettings>
                                <MasterTableView>
                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="Top" />
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="ScheduleDate" HeaderText="Due Date" ItemStyle-Width="80">
                                            <HeaderStyle Font-Bold="True" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn HeaderText="Chart Location">
                                            <ItemTemplate>
     
                                                <telerik:RadAsyncUpload ID="AsyncUpload1" Width="100px" runat="server" TemporaryFolder="Files" PostbackTriggers="btnSave"
                                                    OnFileUploaded="AsyncUpload1_FileUploaded" Style="float: left;"
                                                    OnClientFilesUploaded="OnClientFilesUploaded"
                                                    MultipleFileSelection="Automatic">
                                                    <Localization Select="Browse" />
                                                </telerik:RadAsyncUpload>
                                            </ItemTemplate>
                                            <HeaderStyle Font-Bold="True" />
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                </MasterTableView>
                                <PagerStyle Mode="NumericPages"></PagerStyle>
                                <GroupHeaderItemStyle CssClass="Grid_Header" Height="20px" HorizontalAlign="Left"
                                    VerticalAlign="Middle" />
                                <ClientSettings AllowDragToGroup="true" />
                            </telerik:RadGrid>
                        </td>
                    </tr>
                </table>
            </div>
        </form>
    </body>
    WithGrid.aspx.cs
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
             
     
            dgChartList.DataSource = BindGrid();
            dgChartList.DataBind();
        }
    }
     
    private DataTable BindGrid()
    {
        DataTable dataTable = new DataTable();
       
        dataTable.Columns.Add("ScheduleDate", typeof(string));
       
        dataTable.Rows.Add(new object[] { "05/03/1986" });
        dataTable.Rows.Add(new object[] {  "12/12/1966"});
        dataTable.Rows.Add(new object[] { "15/06/1956" });
        dataTable.Rows.Add(new object[] {  "01/04/1979" });
     
        return dataTable;
    }
     
    public void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        string test = "event Called";
     
        string strFileName = e.File.FileName;
    }
  2. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 01 Aug 2013 Link to this post

    Hello,

     
    I have tested the issue and it worked as expected when I added the onAjaxRequest event in the code behind of the page. Here is a video of my test. 

    Hope this will be helpful.

    Regards,
    Plamen
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top