This is a migrated thread and some comments may be shown as answers.

RadAjaxManager ClientEvents-OnRequestStart event not firing

1 Answer 389 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Chad Johnson
Top achievements
Rank 1
Chad Johnson asked on 19 Apr 2012, 06:05 PM
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>


1 Answer, 1 is accepted

Sort by
0
Chad Johnson
Top achievements
Rank 1
answered on 19 Apr 2012, 06:24 PM
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>

Tags
Upload (Obsolete)
Asked by
Chad Johnson
Top achievements
Rank 1
Answers by
Chad Johnson
Top achievements
Rank 1
Share this question
or