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

LinkButton doesn't fire OnClick

1 Answer 135 Views
Button
This is a migrated thread and some comments may be shown as answers.
Radoslaw
Top achievements
Rank 1
Radoslaw asked on 06 Mar 2013, 09:45 PM
Hi,

The situation is as follows - in my RadGrid, in GridTemplateColumn, I've got a RadButton that is supposed to fire OnClick button. I also have SelectedIndexChanged assigned for the same RadGrid. When the button type was set to StandardButton, everything worked just fine - onClick event was triggered every time I clicked the button. I had to change button type to LinkButton, though (for styling reasons), and from that moment on, clicking the button fires SelectedIndexChanged event, instead (in 90% of cases). How can I force it to raise (or prioritise) OnClick event again?

Regards,
Radek

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 11 Mar 2013, 12:08 PM
Hi Radoslaw,

There is an issue related to the triggering of the server-side OnClick event of the RadButton when its ValidationGroup property is set in Q1 2013.

This issue has already been fixed and the latest internal build (2013.1.227) reflects this fix. The internal build can be used for development and you can download it from  this page.

The fix will also be reflected in the upcoming Q1 2013 SP1 which is scheduled for the beginning of April. For the time being you can use the following workaround:
<script type="text/javascript">
    Telerik.Web.UI.RadButton.prototype._buildPostBackOptions = function() {            
        var options = this._getPostBackOptions() || {
            eventTarget: this.get_uniqueID(),
            eventArgument: this.get_enableSplitButton() ? 'RadButtonEventArguments': '',
            validation: this._validationGroup ? true: false,
            validationGroup: this._validationGroup,
            actionUrl: this._navigateUrl || '',
            trackFocus: false,
            clientSubmit: !this.IsInputTypeSubmit() || this.get_singleClick() || this.get_buttonType() != Telerik.Web.UI.RadButtonType.StandardButton || this.IsImageButton(),
        };                  
        return "new WebForm_PostBackOptions('" + options.eventTarget + "', '"
            + options.eventArgument + "', "
            + options.validation + ", '"
            + options.validationGroup + "', '"
            + options.actionUrl + "', "
            + options.trackFocus + ", "
            + options.clientSubmit + ")";
    }
</script>
Make sure that this function override should be placed at the end of your page.

You can also find more information on this matter in this sticky thread.

Regards,
Danail Vasilev
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
Radoslaw
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or