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

Checkbox value in RadSlidingPane lost

5 Answers 49 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 20 Jul 2009, 07:19 PM
Why is it that if I check a checkbox inside of a RadSlidingPane, and then dock or collapse the pane, the checkbox goes back to being unchecked?  Is there anyway around this?

Thanks,
Justin

5 Answers, 1 is accepted

Sort by
0
Justin
Top achievements
Rank 1
answered on 21 Jul 2009, 11:33 PM
Quick update:  This seems to be an IE 6 specific issue.  I just tested it in Firefox and it works just fine. 

Also, I noticed that the actual value of the checkbox is NOT lost in IE 6.  It's just that the checkmark image disappears.  Unfortunately, IE 6 is my company's standard browser, so I would greatly appreciate any suggestions on how to work around this issue.

Thanks
0
Justin
Top achievements
Rank 1
answered on 22 Jul 2009, 12:00 PM
I found another post from Aug. 5, 2008 where a similar problem was reported, but the issue was with a radio button losing state instead of a checkbox.  A workaround was provided by telerik and a slight modification to this workaround fixes my issue.

It looks like telerik has since fixed the radio button issue but the checkbox problem was introduced somewhere along the way.  Although it may be fixed in the most recent release ... I'm still using Q1 2009 SP2 (version 2009.1.527).

You can view the previous post here:

http://www.telerik.com/community/forums/aspnet-ajax/splitter/radiobuttonlist-problem.aspx

Thanks
0
Justin
Top achievements
Rank 1
answered on 22 Jul 2009, 01:57 PM
I need some help with the workaround I referenced in my last post.  Although it does succeed in preserving the state of the checkbox, it causes an error at the following line when I perform an ajax postback.

this

 

._oldMoveRootToParent(toOriginalParent);

The error is:  Microsoft JScript runtime error: Out of memory

Here is the exact code I'm using:

 

Telerik.Web.UI.RadSlidingPane.prototype._oldMoveRootToParent = Telerik.Web.UI.RadSlidingPane.prototype._moveRootToParent;

Telerik.Web.UI.RadSlidingPane.prototype._moveRootToParent =

function(toOriginalParent){

 

 

    // Save the state.

 

 

    if($telerik.isIE){

 

 

        var rootElement = this._contentElement;

 

 

        var checkedCheckBoxes = [];

 

 

        var allInputs = rootElement.getElementsByTagName('input');

 

 

        for(var i=0, length=allInputs.length; i< length; i++)
        {

 

 

            var input = allInputs[i];

 

 

            if(input.type == 'checkbox')
            {

 

                checkedCheckBoxes.push(input.getAttribute(

'checked'));

 

            }

        }

    }

 

    this._oldMoveRootToParent(toOriginalParent);

 

 

    // Load the state.

 

 

    if($telerik.isIE)

 

    {

 

        var rootElement = this._contentElement;

 

 

        var allInputs = rootElement.getElementsByTagName("input");

 

 

        for(var i=allInputs.length - 1; i>= 0; i--)

 

        {

 

            var input = allInputs[i];

 

 

            if(input.type == 'checkbox')

 

            {

 

                if(checkedCheckBoxes.length == 0) break;

 

                input.setAttribute(

'checked', checkedCheckBoxes.pop());

 

            }

        }

    }

};

Please advise on how to avoid this.

Thanks

0
Justin
Top achievements
Rank 1
answered on 22 Jul 2009, 04:04 PM
I was able to avoid the error by simply removing 2 lines of codes from the workaround which telerik provided 2008.  I'm sure the reason that the workaround didn't always work correctly for me was because it was written for an earlier version of RadControls.  I've included my code below, with the 2 lines commented out. 

I would appreciate it if someone from telerik could answer these questions for me:
1.  Is this issue fixed in the latest version of RadControls?
2.  If not, then does the code below look good or could it still have problems in certain situations?

Thanks

 

//Telerik.Web.UI.RadSlidingPane.prototype._oldMoveRootToParent = Telerik.Web.UI.RadSlidingPane.prototype._moveRootToParent;

 

Telerik.Web.UI.RadSlidingPane.prototype._moveRootToParent =

function(toOriginalParent){

 

 

if($telerik.isIE){

 

 

var rootElement = this._contentElement;

 

 

var checkedCheckBoxes = [];

 

 

var allInputs = rootElement.getElementsByTagName('input');

 

 

for(var i=0, length=allInputs.length; i< length; i++)

 

{

 

var input = allInputs[i];

 

 

if(input.type == 'checkbox')

 

{

checkedCheckBoxes.push(input.getAttribute(

'checked'));

 

}

}

}

 

//this._oldMoveRootToParent(toOriginalParent);

 

 

if($telerik.isIE)

 

{

 

var rootElement = this._contentElement;

 

 

var allInputs = rootElement.getElementsByTagName("input");

 

 

for(var i=allInputs.length - 1; i>= 0; i--)

 

{

 

var input = allInputs[i];

 

 

if(input.type == 'checkbox')

 

{

 

if(checkedCheckBoxes.length == 0) break;

 

input.setAttribute(

'checked', checkedCheckBoxes.pop());

 

}

}

}

};

0
Accepted
Tsvetie
Telerik team
answered on 23 Jul 2009, 11:29 AM
Hello Justin,
Straight to your questions:
  1. The problem is fixed in the Q2 2009 version of the Telerik.Web.UI assembly.
  2. Your code overrides a method in the RadSlidingPane and does not execute its original code - that is move the RadSlidingPane in the DOM. In case the RadSlidingPane does not move in the DOM, you do not need to save/load the state of the checkboxes. As a result, you can replace your code with the following line and still get the same result:
    Telerik.Web.UI.RadSlidingPane.prototype._moveRootToParent = function(){}; 

Sincerely yours,
Tsvetie
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Splitter
Asked by
Justin
Top achievements
Rank 1
Answers by
Justin
Top achievements
Rank 1
Tsvetie
Telerik team
Share this question
or