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

Clicking a button inside a ajaxified usercontrol using javascript

1 Answer 75 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 16 Aug 2010, 01:59 PM
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

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Aug 2010, 03:20 PM
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
Tags
Ajax
Asked by
saravanan k
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or