Clicking a button inside a ajaxified usercontrol using javascript

2 posts, 0 answers
  1. saravanan k
    saravanan k avatar
    88 posts
    Member since:
    Mar 2010

    Posted 16 Aug 2010 Link to this post

    Hi,

    I am having a radgrid assosiated with a radajaxmanager and radajaxloadingpanel. I am using usercontrol insert and edit forms. I am having a button inside insert form (usercontrol). On click of that button i want to confirm with the user. So i wrote the script to call a radconfirm onclientclick of that button and if [OK] button is clicked in the confirm box, i am programatically calling the button click from javascript code using buttonObj.click();

    My code works well in following cases,
                      1. if i use image button in place of asp:button (or)
                       2. if i remove the radajaxmanager and ajaxpanel from the the parent page.

    But not with the normal asp:button. Can you please help me in sorting out the problem.

    My script to call radconfirm,

    <script type="text/javascript">
            var buttonObj;
            var confirmValue = false;
        
            function UpdateConfirm(btn) {
                if (!confirmValue) {
                    buttonObj= btn;
                    var confirmString = "Do you wish to update?.";
                    radconfirm(confirmString, UpdateConfirmCallBackFn, 300, 120, "", "Confirm Update");
                    return false;
                }
            }

        function

     

    UpdateConfirmCallBackFn(arg) {

     

     

            if (arg) {

     

                confirmValue=

    true;

     

                buttonObj.click();

     

            }

     

       }



    My button inside the usercontrol insert form,

    <asp:Button ID="btnUpdate" runat="server" Text="Update"
            ValidationGroup="grp" OnClick="btn_Click" OnClientClick="return UpdateConfirm(this);" />

    My RadAjaxManager Code in the parent grid page,

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
                Loading...
            </telerik:RadAjaxLoadingPanel>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="grid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="grid1" />
                                                </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>

    Regards,
    Saravanan K
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 18 Aug 2010 Link to this post

    Hi,

    In this scenario I would suggest you to use the ResponseScripts property of the RadAjaxManager in order to execute the custom script you need. Please refer to the following help topic which elaborates on this matter.

    Best wishes,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top