RadAjaxManager ClientEvents-OnRequestStart event not firing

Thread is closed for posting
2 posts, 0 answers
  1. Chad Johnson
    Chad Johnson avatar
    17 posts
    Member since:
    Apr 2010

    Posted 19 Apr 2012 Link to this post

    I am trying to upload files via a RadGrid that is Ajaxified.  Based on the demos, I am trying to disable Ajax when the "Insert" button is clicked when trying to add a new row to the grid.  The ClientEvents-OnRequestStart event is never firing.

    Does anyone have any ideas what I might be doing wrong?

    Here is the code for my aspx page:

    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="radScriptManager" runat="server" />
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function conditionalPostback(sender, args) {
     
                    alert('ConditionalPostBack');
     
                    var theRegexp = new RegExp("\.RadButtonInsert$", "ig");
     
                    if (args.get_eventTarget().match(theRegexp)) {
                        var upload = $find(window['RadUpload1']);
     
                        if (upload.GetFileInputs()[0].value != "") {
                            args.set_enableAjax(false);
                        }
                    }
                }
            </script>
     
        </telerik:RadCodeBlock>
     
     
            <telerik:RadAjaxManager ID="radAjaxManager" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="radButtonEdit">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="panelToolbar" />
                            <telerik:AjaxUpdatedControl ControlID="panelContent" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="radButtonSave">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="panelToolbar" />
                            <telerik:AjaxUpdatedControl ControlID="panelContent" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
     
            <asp:Panel runat="server">
                <asp:Panel ID="panelToolbar" runat="server">
                    <telerik:RadButton ID="radButtonEdit" runat="server" Text="Edit" CausesValidation="false" OnClick="radButtonEdit_Click" />
                    <telerik:RadButton ID="radButtonSave" runat="server" Text="Save" CausesValidation="true" OnClick="radButtonSave_Click" />
                </asp:Panel>
     
                <asp:Panel ID="panelContent" runat="server">
     
                    <telerik:RadPanelBar ID="radPanelBarAttachments" runat="server" Width="100%">
                        <Items>
                            <telerik:RadPanelItem Text="Attachments" Expanded="true">
                                <ContentTemplate>
     
                                    <telerik:RadGrid ID="radGridAttachments" runat="server" AutoGenerateColumns="false" OnNeedDataSource="radGridAttachments_NeedDataSource" OnInsertCommand="radGridAttachments_InsertCommand" OnDeleteCommand="radGridAttachments_DeleteCommand" OnItemCommand="radGridAttachments_ItemCommand">
                                        <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID">
                                            <CommandItemTemplate>
                                                <telerik:RadButton ID="radButtonAdd" runat="server" Text="Add New Record" CommandName="InitInsert" Visible='<%# !radGridAttachments.MasterTableView.IsItemInserted %>' ButtonType="LinkButton">
                                                </telerik:RadButton>
                                            </CommandItemTemplate>
                                            <Columns>
                                                <telerik:GridBoundColumn DataField="ID" HeaderText="ID" ReadOnly="true" />
                                                <telerik:GridBoundColumn UniqueName="FileName" DataField="FileName" HeaderText="File Name" ReadOnly="true" />
                                                <telerik:GridTemplateColumn HeaderText="Attachment (LinkButton)">
                                                    <ItemTemplate>
                                                        <asp:LinkButton ID="ViewAttachmentLinkButton" runat="server" CommandName="ViewAttachment">View</asp:LinkButton>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="PushButton" Text="Delete" CommandName="Delete" />                             
                                            </Columns>
                                            <EditFormSettings EditFormType="Template">
                                                <FormTemplate>
                                                    <telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" ControlObjectsVisibility="None" />                                              
                                                    <telerik:RadButton ID="RadButtonInsert" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
                                                    <telerik:RadButton ID="RadButtonCancel" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel" />
                                                </FormTemplate>
                                            </EditFormSettings>
                                        </MasterTableView>
                                    </telerik:RadGrid>
     
                                </ContentTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelBar>
                </asp:Panel>
                    
            </asp:Panel>
     
        </form>
    </body>
    </html>


  2. Chad Johnson
    Chad Johnson avatar
    17 posts
    Member since:
    Apr 2010

    Posted 19 Apr 2012 Link to this post

    OK I guess I posted a bit prematurely...the reason I wasn't seeing the event occur is because my grid isn't actually ajaxified itself.  I added the following to the RadAjaxManager and I am now receiving the event.

    <telerik:AjaxSetting AjaxControlID="radGridAttachments">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="radGridAttachments" />
        </UpdatedControls>
    </telerik:AjaxSetting>

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