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

RadButton OnCheckedChanged doesn't PostBack on CheckChange By Space Key

3 Answers 167 Views
Button
This is a migrated thread and some comments may be shown as answers.
Murilo
Top achievements
Rank 1
Murilo asked on 26 Jul 2011, 02:44 PM
Hi,

We are using RadButton as CheckBoxes and we catch a problem when trying to check the button with the keyboard, when the user checks it with the space key, only the client-side event fires.

We tried first this code:
<telerik:RadButton runat="server" ID="chkIMOPRO" Text="IMO Product" ButtonType="ToggleButton"
               AutoPostBack="true" ToggleType="CheckBox" OnCheckedChanged="chkIMOPRO_CheckedChanged">
               <ToggleStates>
                   <telerik:RadButtonToggleState Selected="true" />
                   <telerik:RadButtonToggleState Selected="false" />
               </ToggleStates>
</telerik:RadButton>

With that code, everything worked fine, but when one user tried to check it with the keyboard, nothing really happens, we are getting to the server side through RadAjax:
<telerik:RadAjaxManager runat="server" ID="ajaxManager" OnAjaxRequest="ajaxRequest"
        EnableAJAX="true">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="chkIMOPRO" EventName="chkIMOPRO_CheckedChanged">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlIMOINFO" LoadingPanelID="loadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

And then, we tried the following approach:
function chkIMOPRO_CheckedChanged(sender, args) {
    alert('');
}

<telerik:RadButton runat="server" ID="chkIMOPRO" Text="IMO Product" ButtonType="ToggleButton"
    AutoPostBack="true" ToggleType="CheckBox" OnCheckedChanged="chkIMOPRO_CheckedChanged"
    OnClientCheckedChanged="chkIMOPRO_CheckedChanged">
    <ToggleStates>
        <telerik:RadButtonToggleState Selected="true" />
        <telerik:RadButtonToggleState Selected="false" />
    </ToggleStates>
</telerik:RadButton>

And it worked, the client-side event fires in the two cases (by keyboard space and by mouse click).

We know we can get it to work by activating ajax through javascript, but we think this would be unecessary code.

Is there any bug or approach related to this issue?

Thanks;

3 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 27 Jul 2011, 03:56 PM
Hi Murilo,

Currently RadButton doesn't initiate postback, when it is set as CheckBox, it has AutoPostBack property set to true, and it is checked or unchecked with keyboard 'space' key. Nevertheless, there is still a possible solution that may fulfill your requirement.  You can use RadButton's client side event OnCheckedChanged to programmatically click it and post the page, via the JavaScript method .click().

You can find attached a sample project, demonstrating the provided solution. Please use it as a basis for your further development.

In the following link you can check the PITS Issue that I logged for this feature request: Public URL. We will implement it in one of the upcoming releases, although I cannot provide a firm estimate if it will be available in Q2 2011 SP1.
  
Greetings,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
ARNALDO
Top achievements
Rank 1
answered on 24 Mar 2012, 04:23 PM
Hi Slav,

Is there any ETA for this feature? Can you give us a workaround while the feature is not implemented?

Our customers are asking us everyday about this, thank you :)

Edit:
The workaround sent above worked, thanks.
0
Slav
Telerik team
answered on 28 Mar 2012, 01:40 PM
Hello Arnaldo,

This feature is not planned for implementing as there are tasks with higher priority. Nevertheless, it will be considered for inclusion if there is enough interest.

As you have already found out, the desired effect can be achieved with the solution, provided in my last post, so you can use it for the time being.

All the best,
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
Murilo
Top achievements
Rank 1
Answers by
Slav
Telerik team
ARNALDO
Top achievements
Rank 1
Share this question
or