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

Pager works even when RadGrid Enable is false

1 Answer 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 10 Nov 2009, 12:38 PM
Hi All,

Have a RadGrid.

I have set Enable="false"

But the pager works. How to stop it.

                   
function DisableGrid(disable)  
    {        
        document.getElementById("RadGridEarnings").disabled = disable;  
        document.getElementById("RadGridDeduction").disabled = disable;          
    }  
<telerik:RadGrid ID=
"RadGridEarnings" runat="server" AutoGenerateColumns="true" Height="202px" 
                        Width="180px"  AllowPaging="true" Skin="Vista" DataSourceID="dsiSmartEarn" 
                        OnItemDataBound="RadGridEarnings_ItemDataBound" >  
                        <PagerStyle Mode="NextPrevAndNumeric" PagerTextFormat="{4}" AlwaysVisible="true" />  
                        <MasterTableView AutoGenerateColumns="false" PageSize="7" DataSourceID="dsiSmartEarn" CommandItemDisplay="None" 
                            Width="100%" ClientDataKeyNames="EDShortDesc">  
                            <Columns>  
                                <telerik:GridBoundColumn UniqueName="EDCode" DataField="EDCode" HeaderText="EDCode" 
                                    Visible="false" ReadOnly="true">  
                                </telerik:GridBoundColumn>  
                                <telerik:GridBoundColumn UniqueName="EDShortDesc" DataField="EDShortDesc" HeaderText="Earning">  
                                </telerik:GridBoundColumn>  
                                <telerik:GridBoundColumn UniqueName="Formula" DataField="Formula" HeaderText="Formula">  
                                </telerik:GridBoundColumn>  
                            </Columns>  
                        </MasterTableView>  
                        <ClientSettings>  
                            <ClientEvents OnRowDblClick="EarningDblClick" />  
                        </ClientSettings>  
                    </telerik:RadGrid> 


I have made the Enable= false in javascript.

But only the pager works. Is there any option to stop it.

-Anto

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 Nov 2009, 12:51 PM
Hi Anto,

RadGrid is not a simple textbox and cannot be disabled with a single statement. Here is how to do it:


Javascript


    var elements = $get("RadGrid1").getElementsByTagName("*");
    for (var j = 0; j < elements.length; j++)
    {
        if (elements[j].tagName && !(elements[j].className == "rcbInput" || (elements[j].tagName.toLowerCase() == "input" && elements[j].type == "hidden")))
        try
        {
            elements[j].disabled = "disabled";
        }
        catch (e) {}
    }


$get() is the same as getElementById().



All the best,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Share this question
or