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

button.click different than clicking on button

3 Answers 77 Views
Button
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Albert Shenker asked on 11 Oct 2012, 06:08 PM
I have a rad button which implements the single click solutoin provided by Telerik to pervent multiple submissions.

My declaration is:

<telerik:RadButton ID="btnFind" runat="server" Text="Find Visits" style="margin:7px;" UseSubmitBehavior="false" OnClientClicked="FindClickedHandler_VFC">
                                <Icon PrimaryIconUrl="~/global/images/icons/search.png" />
                            </telerik:RadButton>


And I have a handler for the OnClientClicked Event:

function FindClickedHandler_VFC(sender, eventArgs) {
 
            var validated = Page_ClientValidate('val');
            if (!validated) {
                return;
            }
            else {
                sender.set_enabled(false);
                if (sender.get_text() == "Search") sender.set_text("Searching...");
            }
        }


When I click on the button, everything works as expected. However, in some instances, I would like to induce the button click and have it do exactly the same from some client-side code. When I call the button.click function client-side I have noticed that the cliked handler does fire, but the postback never occurs. I am guessing this has something to do with the removal of the postback behavior in the button which is necessary to prevent the double click. Is there a way to make the button do the same thing whether you click on it or call button.click client-side?

3 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 16 Oct 2012, 11:05 AM
Hi Albert,

I tried to reproduce the problem you encountered, but to no avail. You can find attached my test page. Please compare it with your actual project and check if there are differences in the setup. This screen capture displays the behavior on my end.

I would suggest checking if you are canceling the postback of the RadButton somewhere in your script, for example by calling the method set_autoPostBack(false) or set_cancel(true) in the handler of the OnClientClicking event.

Note that I am mostly guessing as to what your actual setup is. If the problem persists, please open a regular support ticket and try modifying the attached sample so that it matches your case. If this is not possible you can also prepare and send a simple, fully runnable page that isolates the issue, which will allow me to inspect it locally and provide a more to the point answer.

Kind regards,
Slav
the Telerik team
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 their blog feed now.
0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 16 Oct 2012, 03:30 PM
In my app, the radbutton is inside a panel which is ajaxified (the panel is the initiator and updated control). I also have an ajax setting where the rad button is the initiator and a second panel is the updated control. Can you make these two ajax modifications to your sample and see if it still works prior to my trying to create a stripped-out example?
0
Slav
Telerik team
answered on 19 Oct 2012, 08:32 AM
Hello Albert,

I updated my sample according to your description, but I still cannot reproduce the problem. Please check the attached page and let me know if I have missed something.

The problem you encountered could also be result of a JavaScript error that occurs when an Ajax request is initiated. You can use the console of your browser's developer tools to ensure if this is the case.

If you are still having difficulties, please send a modified version of the provided sample or a simple, runnable page that isolates the issue. This way I can reproduce the problem locally and suggest an according solution.

Regards,
Slav
the Telerik team
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 their blog feed now.
Tags
Button
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Answers by
Slav
Telerik team
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Share this question
or