AJAX Control Toolkit Compatability

Thread is closed for posting
115 posts, 0 answers
  1. Alex Ruggeri
    Alex Ruggeri avatar
    4 posts
    Member since:
    Jan 2010

    Posted 25 Jun 2010 Link to this post

    Thanks for the update.

    Do we have access to the internal build and is it something we could use in a production server? If not, when will we have a version we can use on a production server.

    Cheers

    Pete
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 25 Jun 2010 Link to this post

    Hello Alex,

    The build will be available later today. We recommend using it only for testing, although it contains only bugfixes and should be stable.

    The fix will also be included in the Q2 release due in mid-July.

    I hope this helps.

    All the best,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Charles Wiebe
    Charles Wiebe avatar
    11 posts
    Member since:
    Feb 2010

    Posted 30 Jun 2010 Link to this post

    I too am getting the error "AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced".
    I am using .net 3.5 with Rad Controls 2010.1.519.35.
    The Master Page uses:

     <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePartialRendering="false" >
        <CdnSettings TelerikCdn="Enabled" />
        <Scripts>
            <asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Name="MicrosoftAjax.js" Path="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js" />
        </Scripts>
    </telerik:RadScriptManager>

    I have tried a number of combinations based on this thread, but no joy. I think that it is specific to .net 4.0.
    What should I do?
  4. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 30 Jun 2010 Link to this post

    Hi Charles,

    Refer to the last couple of posts by my colleague Tsvetomir and let me know if you have additional inquiries.

    Best regards,
    Sebastian
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Rick Atkinson
    Rick Atkinson avatar
    11 posts
    Member since:
    Feb 2010

    Posted 13 Jul 2010 Link to this post

    Hi Sebastian.  I am using the Q2 2010 Telerik Beta along with the latest version of Ajax Control Toolkit (4.0).

    I am still experiencing errors with it.  I get:

    Line: 4686
    Error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.


    Do you have a sample project that demonstrates that the combination of Telerik and ACT can integrate now?

    Thanks, Rick.
  6. Paul
    Paul avatar
    3 posts
    Member since:
    Jun 2009

    Posted 24 Jul 2010 Link to this post


    Hi, I have succefully used solution posted by Admin on 5 May to get 2010.1.519.40 and ACT to work together.

    Can you tell me though, which - if any - of the CDN scripts I can use instead of the included:
    /Scripts/MicrosoftAjax.js

    /Scripts/MicrosoftAjaxWebForms.js

    Thanks
  7. Rodrigo
    Rodrigo avatar
    5 posts
    Member since:
    Sep 2010

    Posted 09 Sep 2010 Link to this post

    Hi guys,

    I'm having a lot of troubles using ASP.Net WebForms 4   Route Urls   Telerik ASP.NET AJAX Controls version 2010 Q2 826.

    Problems that i'm facing are:

    - Ajax RadControls are losing all the Layout and Effects;
    - RadTextBoxes are losing the text value on the code-behind.

    What do i need to do to solve these problems? Please Help me!!!

    PS.: When i remove the urls route all the problems disappear.

    Thanks a lot!!!
  8. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 10 Sep 2010 Link to this post

    Hi Rodrigo,

    If your question is not related to the topic of this forum thread (AJAX Control Toolkit Compatibility), I suggest we continue discussing your question in the other forum thread you have deliberately started for it.

    Veli
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Widmeyer Lisboa
    Widmeyer Lisboa avatar
    1 posts
    Member since:
    Apr 2010

    Posted 23 Sep 2010 Link to this post

    To correct this issue for VS2010 and IIS7 (.NET 4.0) you have follow one of the 2 steps:

     

    1)web.config: Include handler 

     

    <httpHandlers>
    <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    <add verb="*" path="pricelist.csv" validate="false" type="NopSolutions.NopCommerce.BusinessLogic.ExportImport.PricelistHandler, Nop.BusinessLogic"/>
    <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
    </httpHandlers>

     

    <httpHandlers>

    ...

    <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>

    </httpHandlers>

     

     

     

    2) IIS7: Add the MIME Type (.ashx) for your application 

    Extension: .ashx

    Type: text/html

     

    Regards,

     

    Widmeyer Lisboa

    http://www.kronnuz.com.br

  10. JLC
    JLC avatar
    3 posts
    Member since:
    Nov 2010

    Posted 05 Nov 2010 Link to this post

    Hello there,

    I'm using IIS: 5.1 .Net Framework 3.5 and VS 2008

    I'm also using AjaxControlToolkit version: 3.0.30930.28736

    Curiously, the error bellow happens only when pt-BR culture is selected:

       
    <script type="text/javascript">   
       
    //<![CDATA[
    var __cultureInfo = '{"name":"pt-BR","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":",","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":".","CurrencySymbol":"R$ ","NaNSymbol":"NaN (No um nmero)","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":1,"PercentNegativePattern":1,"NegativeInfinitySymbol":"-Infinito","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":",","NumberGroupSeparator":".","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"+Infinito","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":",","PercentGroupSeparator":".","PercentSymbol":"%","PerMilleSymbol":"","NativeDigits":["0","1","2","  ...
     ... setembro","outubro","novembro","dezembro",""]}}';//]]>  
     </script>
      
    <script src="../Javascript/System.Web.Extensions/1.0.61025.0/MicrosoftAjax.debug.pt.js" type="text/javascript">
    </script> 
       
    <script type="text/javascript">  
      
    //<![CDATA[
      
    if (typeof(Sys) === 'undefined') throw new Error('A estrutura do cliente do ASP.NET Ajax falhou ao ser carregada.'); 
      
    //]]> 

     

     

    If I try adding the HTTP HANDLER suggested above I get:

    Parser Error Message: Could not load file or assembly 'Ajax' or one of its dependencies.


    I don't know if this is the correct place to post this but any help will be appreciated

    Thanks

    Jose

  11. JLC
    JLC avatar
    3 posts
    Member since:
    Nov 2010

    Posted 08 Nov 2010 Link to this post

    I am still getting this error but I found out it happens on IE7 but not in Firefox!

    Strange isn't it?

    So in summary the problem only happens when changing the culture to pt-BR.

    The problem happens in IE7 but not in FIREFOX!

    Please help me.

    Thanks,

    Jose
  12. sahil
    sahil avatar
    35 posts
    Member since:
    Jul 2008

    Posted 17 Nov 2010 Link to this post

    No final solution till find?
  13. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 18 Nov 2010 Link to this post

    Hello Jose,

    We are unable to identify what's causing this issue. If you open a regular support ticket and send us a test project we can debug locally, we would be able to assist you better on that.

    Veli
    the Telerik team
    Browse the vast support resources we have to jumpstart 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.
  14. JLC
    JLC avatar
    3 posts
    Member since:
    Nov 2010

    Posted 18 Nov 2010 Link to this post

    We solved the problem simply by copying Javascript/System.Web.Extensions/1.0.61025.0/MicrosoftAjax.debug.js into Javascript/System.Web.Extensions/1.0.61025.0/MicrosoftAjax.debug.pt.js

    I wonder why the other languages didn't require this but the important thing is that problem is gone.

    Thanks!

    Jose
  15. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 08 Jun 2011 Link to this post

    I am using the latest version of the Telerik suite (2011.1.519.40) and also started using the Ajax Control Toolkit. Just by referencing it to my project, without using ANY of the actual functionality, when I try to use a RadAjaxManager on a page I get the following Javascript error:

    Unable to get value of the property 'id': object is null or undefined.

    This occurs at the following point in one of the embedded scripts from the Telerik suite:

    if(this.Type=="Telerik.Web.UI.RadAjaxManager"){if(i.get_postBackElement()!=this.get_element()){var c=this._updatePanels.split(",");
    if(Array.contains(c,i.get_postBackElement().id)){this._isRequestInProgress=true;
    this._attachRequestHandlers(f,i,false);
    return false;

    The line that fails is in bold. It tells me i.get_postBackElement() is null or undefined. The page being hosted is inside a RadWindow modal instance with a single master page that has the standard <asp:ScriptManager runat="server" /> line on it.

    Any ideas? Remember - all I did was add the reference to the toolkit (version 4.1.50401.0). I'm not using anything from it at all, just the reference for now. As soon as I remove the reference the AjaxManager works exactly as I would have expected it to.

    Edit: This occurs with IE9 and when I put IE9 into compatibility mode (presumably IE8).
  16. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 09 Jun 2011 Link to this post

    Hello digitall,

    Is this under .NET 4.0? If so, try setting ClientIDMode="AutoID" in your page. There is a known limitation with the toolkit reference and RadAjax in .NET 4.0 that is caused by the scripts inside the AjaxControlToolkit.dll getting referenced instead of the MS AJAX scripts.

    Veli
    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.

  17. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 09 Jun 2011 Link to this post

    That appears to have done the trick!

    I know you don't support the AJAX Toolkit, but is there a reason they do whatever it is they do that caused me to have to change this? Did I possibly lose functionality from them by making this change?
  18. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 10 Jun 2011 Link to this post

    I don't think you have lost any functionality from the toolkit by setting ClientIDMode="AutoID" in .NET40. It's more an issue with RadAjax controls for which this workaround was needed.

    Veli
    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.

  19. allenh
    allenh avatar
    6 posts
    Member since:
    Jun 2007

    Posted 06 Jul 2011 Link to this post

    I just upgraded from .Net 2 to Net 4.0  

     

    I am using version 2011.1.519.40 + the ajaxcontroltoolkit version 4.1.50401.0 both in the bin directory

    the page in question has the following controls (among other radcontrols )

    • RadScriptManager
    • RadAjaxManager
    • RadAjaxLoadingPanel
    • RadGrid


    "the toolkit is not used on the page that is throwing errors – it’s just referenced in the project"

    symptoms:

    if the page in question is not touched for a short period of time and the "refresh" button of the radgrid is clicked  I get "updatepanelids is null or not an object"

    I noticed that a possible solution is to add ClientIDMode="AutoID", but this does not solve the problem – (i have this setting in my web.config)

    My main question is there a workaround for this situation and / or is there a fix in the upcoming July release?

     

    I am being forced to move to Net 4.0 , so I have to find a workable solution

     

    thanks

  20. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 07 Jul 2011 Link to this post

    Hello Allenh,

    Is the error gone if you remove the AJAX control toolkit from the Bin folder? If this is the case, setting AutoID is the only workaround we are currently aware of. You may want to consider opening a regular support ticket in which you can attach some test project demonstrating this issue. It would be very helpful for us to reproduce this error locally, trying to identify the cause of this issue. Please refer to this forum thread if you choose to open a  ticket.

    Veli
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  21. allenh
    allenh avatar
    6 posts
    Member since:
    Jun 2007

    Posted 07 Jul 2011 Link to this post

    thanks for the prompt reply - i'm  removing the control toolkit  now and i'll open a ticket with my findings
  22. Zura Chikhladze
    Zura Chikhladze avatar
    32 posts
    Member since:
    Jul 2009

    Posted 02 Aug 2011 Link to this post

    Hi, I would like to ask your advice on the following question:

    Which technology do you advice me to use Telerik or Silverlight for the web business applications where the number of web forms exceed 500? Thank you. Z.
  23. Velmurugan
    Velmurugan avatar
    37 posts
    Member since:
    Aug 2011

    Posted 11 Oct 2011 Link to this post

    hi ,i am velmurugan,
                                  this is my code for selecting all check box column when i am click the header checkbox in gridview.
                  but i need like this task using radgrid,plz help me.........

               <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript">
            var TotalChkBx;
             var TotalChkBx1;
            var Counter;
                var Counter1;
            window.onload = function()
            {
                //Get total no. of CheckBoxes in side the GridView.
                TotalChkBx = parseInt('<%= this.GridView1.Rows.Count %>');
                //Get total no. of checked CheckBoxes in side the GridView.
                Counter = 0;
            }     
            function HeaderClick(CheckBox)
            {
                //Get target base & child control.
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkBxSelect";      
                //Get all the control of the type INPUT in the base control.
                var Inputs = TargetBaseControl.getElementsByTagName("input"); 
                //Checked/Unchecked all the checkBoxes in side the GridView.
                for(var n = 0; n < Inputs.length; ++n)
                    if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
                         Inputs[n].checked = CheckBox.checked;
                //Reset Counter
                Counter = CheckBox.checked ? TotalChkBx : 0;
            }        
            function ChildClick(CheckBox, HCheckBox)
            {
                //get target base & child control.
                var HeaderCheckBox = document.getElementById(HCheckBox);    
                //Modifiy Counter;            
                if(CheckBox.checked && Counter < TotalChkBx)
                    Counter++;
                else if(Counter > 0) 
                    Counter--     
                //Change state of the header CheckBox.
                if(Counter < TotalChkBx)
                    HeaderCheckBox.checked = false;
                else if(Counter == TotalChkBx)
                    HeaderCheckBox.checked = true;
            }   
            function Headertest(CheckBox)
            {
                //Get target base & child control.
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkBxTest";
                
                //Get all the control of the type INPUT in the base control.
                var Inputs = TargetBaseControl.getElementsByTagName("input");
                
                //Checked/Unchecked all the checkBoxes in side the GridView.
                for(var n = 0; n < Inputs.length; ++n)
                    if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
                         Inputs[n].checked = CheckBox.checked;
                //Reset Counter
                Counter = CheckBox.checked ? TotalChkBx : 0;
            }
             function HeaderDelete(CheckBox)
            {
                //Get target base & child control.
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkBxDelete";
                
                //Get all the control of the type INPUT in the base control.
                var Inputs = TargetBaseControl.getElementsByTagName("input");
                
                //Checked/Unchecked all the checkBoxes in side the GridView.
                for(var n = 0; n < Inputs.length; ++n)
                    if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
                         Inputs[n].checked = CheckBox.checked;
                //Reset Counter
                Counter = CheckBox.checked ? TotalChkBx : 0;
            }
            
            function HeaderUpdate(CheckBox)
            {
                //Get target base & child control.
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkBxUpdate";
                
                //Get all the control of the type INPUT in the base control.
                var Inputs = TargetBaseControl.getElementsByTagName("input")
                for(var n = 0; n < Inputs.length; ++n)
                    if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
                         Inputs[n].checked = CheckBox.checked;
                //Reset Counter
                Counter = CheckBox.checked ? TotalChkBx : 0;
            }
            function HeaderNone(CheckBox)
            {
                //Get target base & child control.
                var TargetBaseControl = document.getElementById('<%= this.GridView1.ClientID %>');
                var TargetChildControl = "chkBxNone";
                
                //Get all the control of the type INPUT in the base control.
                var Inputs = TargetBaseControl.getElementsByTagName("input");
                
                //Checked/Unchecked all the checkBoxes in side the GridView.
                for(var n = 0; n < Inputs.length; ++n)
                    if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
                         Inputs[n].checked = CheckBox.checked;
                //Reset Counter
                Counter = CheckBox.checked ? TotalChkBx : 0;
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
          <asp:GridView runat="server" AutoGenerateColumns="false" ID="GridView1" OnRowCreated="GridView1_RowCreated" >
                <Columns>
                <asp:TemplateField HeaderText ="bloodgroup_code">
          <ItemTemplate>
               <asp:Label ID="label1" runat="server" Text='<%#Eval("bloodgroup_code")%>' > </asp:Label>
          </ItemTemplate>
           </asp:TemplateField>  
           <asp:TemplateField HeaderText ="bloodgroup_name">
          <ItemTemplate>
               <asp:Label ID="label2" runat="server" Text='<%#Eval("bloodgroup_name")%>' > </asp:Label>
          </ItemTemplate>
           </asp:TemplateField> 
           
           <asp:TemplateField HeaderText="Select">
                  <ItemTemplate>
                          <asp:CheckBox ID="chkBxSelect" runat="server" />
                   </ItemTemplate>
              <HeaderTemplate>
                 <asp:CheckBox ID="chkBxHeader" onclick="javascript:HeaderClick(this);" runat="server" Text="Add" />
               </HeaderTemplate>
             </asp:TemplateField>
             <asp:TemplateField HeaderText="Select">
                  <ItemTemplate>
                          <asp:CheckBox ID="chkBxTest" runat="server" />
                   </ItemTemplate>
              <HeaderTemplate>
                 <asp:CheckBox ID="chkBxHeadertest" onclick="javascript:Headertest(this);" runat="server" Text="Edit" />
               </HeaderTemplate>
             </asp:TemplateField>
             
             <asp:TemplateField HeaderText="Select">
                  <ItemTemplate>
                          <asp:CheckBox ID="chkBxDelete" runat="server" />
                   </ItemTemplate>
              <HeaderTemplate>
                 <asp:CheckBox ID="chkBxHeaderDelete" onclick="javascript:HeaderDelete(this);" runat="server" Text="Delete" />
               </HeaderTemplate>
             </asp:TemplateField>
             <asp:TemplateField HeaderText="Select">
                  <ItemTemplate>
                          <asp:CheckBox ID="chkBxUpdate" runat="server" />
                   </ItemTemplate>
              <HeaderTemplate>
                 <asp:CheckBox ID="chkBxHeaderUpdate" onclick="javascript:HeaderUpdate(this);" runat="server" Text="Update" />
               </HeaderTemplate>
             </asp:TemplateField>
             <asp:TemplateField HeaderText="Select">
                  <ItemTemplate>
                          <asp:CheckBox ID="chkBxNone" runat="server" />
                   </ItemTemplate>
              <HeaderTemplate>
                 <asp:CheckBox ID="chkBxHeaderNone" onclick="javascript:HeaderNone(this);" runat="server" Text="None" />
               </HeaderTemplate>
             </asp:TemplateField>
            </Columns>
                <RowStyle BackColor="Moccasin" />
                <AlternatingRowStyle BackColor="NavajoWhite" />
                <HeaderStyle BackColor="DarkOrange" Font-Bold="True" ForeColor="White" />
          </asp:GridView>       
        </div>
        </form>
    </body>
    </html>
    c# code:
    =======
    public partial class Default2 : System.Web.UI.Page
    {   SqlConnection con;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack == true)
            {
                bind();
            }  }
        public void bind()
        {
              con = new SqlConnection("Data Source=VELMURUGAN\\SQLEXPRESS;Initial Catalog=Smail;User ID=sa;password=kcgit");
             con.Open();
             SqlDataAdapter ada = new SqlDataAdapter("select * from Bloodgroup_master", con);
             DataSet ds = new DataSet();
             ada.Fill(ds, "Bloodgroup_master");
             GridView1.DataSource = ds.Tables[0];
             GridView1.DataBind();
             con.Close();
        }
        protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate))
            {
                CheckBox chkBxSelect = (CheckBox)e.Row.Cells[1].FindControl("chkBxSelect");
                CheckBox chkBxHeader = (CheckBox)this.GridView1.HeaderRow.FindControl("chkBxHeader");
                chkBxSelect.Attributes["onclick"] = string.Format("javascript:ChildClick(this,'{0}');", chkBxHeader.ClientID);

                CheckBox chkBxtest = (CheckBox)e.Row.Cells[2].FindControl("chkBxTest");
                CheckBox chkBxHeadertest = (CheckBox)this.GridView1.HeaderRow.FindControl("chkBxHeadertest");
                chkBxtest.Attributes["onclick"] = string.Format("javascript:Childtest(this,'{0}');", chkBxHeadertest.ClientID);

                CheckBox chkBxDelete = (CheckBox)e.Row.Cells[2].FindControl("chkBxDelete");
                CheckBox chkBxHeaderDelete = (CheckBox)this.GridView1.HeaderRow.FindControl("chkBxHeaderDelete");
                chkBxDelete.Attributes["onclick"] = string.Format("javascript:Childtest(this,'{0}');", chkBxHeaderDelete.ClientID);

                CheckBox chkBxUpdate = (CheckBox)e.Row.Cells[2].FindControl("chkBxUpdate");
                CheckBox chkBxHeaderUpdate = (CheckBox)this.GridView1.HeaderRow.FindControl("chkBxHeaderUpdate");
                chkBxUpdate.Attributes["onclick"] = string.Format("javascript:Childtest(this,'{0}');", chkBxHeaderUpdate.ClientID);

                CheckBox chkBxNone = (CheckBox)e.Row.Cells[2].FindControl("chkBxNone");
                CheckBox chkBxHeaderNone = (CheckBox)this.GridView1.HeaderRow.FindControl("chkBxHeaderNone");
                chkBxNone.Attributes["onclick"] = string.Format("javascript:Childtest(this,'{0}');", chkBxHeaderNone.ClientID);
            }  }}
     i have attached my output for selecting all checkbox






  24. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 11 Oct 2011 Link to this post

    Hi Velmurugan,

    To implement this scenario, you need to find all checkBoxes in RadGrid's template column along with the checkbox in the header template. You then need to keep track of the checked items and update the header checkBox. Here is one approach that uses unobtrusive javascript (i.e. your markup is not polluted with javascript event handler calls):

    <telerik:RadGrid ID="RadGrid1" runat="server" Width="800px"
        OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView>
            <Columns>
                <telerik:GridTemplateColumn>
                    <HeaderTemplate>
                        <asp:CheckBox ID="HeaderCheckBox" runat="server" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="ItemCheckBox" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
     
    <script type="text/javascript">           
        function pageLoad()
        {
            var grid = $find('<%= RadGrid1.ClientID %>');
                     
            grid._checkBoxes = [];
            grid._headerCheckBox = null;
            grid._checkedCount = 0;
     
            var inputs = grid.get_element().getElementsByTagName("input");
            for (var i = 0; i < inputs.length; i++)
            {
                if (inputs[i].type === "checkbox")
                {
                    var chkBox = inputs[i];                       
                    if (chkBox.id.indexOf("ItemCheckBox") > -1)
                    {
                        grid._checkBoxes[grid._checkBoxes.length] = chkBox;
                        $addHandler(chkBox, "change", Function.createDelegate(grid, itemCheckBoxChange));
                        if (chkBox.checked)
                        {
                            grid._checkedCount++;
                        }
                    }
                    if (chkBox.id.indexOf("HeaderCheckBox") > -1)
                    {
                        grid._headerCheckBox = chkBox;
                        $addHandler(chkBox, "change", Function.createDelegate(grid, headerCheckBoxChange));
                    }
                }
            }
     
            updateHeaderCheckBox.call(grid);
        }
     
        function itemCheckBoxChange(args)
        {
            //this refers to the RadGrid client component
            var chkBox = args.target;
            if (chkBox.checked)
            {
                this._checkedCount++;
            }
            else
            {
                this._checkedCount--;
            }
                     
            updateHeaderCheckBox.call(this);
        }
     
        function headerCheckBoxChange(args)
        {
            //this refers to the RadGrid client component
            for (var i = 0; i < this._checkBoxes.length; i++)
            {
                this._checkBoxes[i].checked = args.target.checked;
            }
     
            //update the checked count
            if (args.target.checked)
            {
                this._checkedCount = this._checkBoxes.length;
            }
            else
            {
                this._checkedCount = 0;
            }
        }
     
        function updateHeaderCheckBox()
        {
            //compare the number of checkboxes and the checked count
            //set the header checkbox state accordingly
            if (this._headerCheckBox && this._checkedCount)
            {
                this._headerCheckBox.checked = this._checkedCount === this._checkBoxes.length;
            }
        }
    </script>

    Veli
    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
  25. Velmurugan
    Velmurugan avatar
    37 posts
    Member since:
    Aug 2011

    Posted 12 Oct 2011 Link to this post

    hi........

               thanks for your response
             i have using this code.
              but i got some error  =(  System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). ).....

    reply me plz
  26. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 12 Oct 2011 Link to this post

    Hi, I am Prangadj.

    Have you use radcodeblock for javascript section? Thus no error should be there.


  27. Velmurugan
    Velmurugan avatar
    37 posts
    Member since:
    Aug 2011

    Posted 12 Oct 2011 Link to this post

    no  sir,,i am using same code(above mentioned) only....
  28. digitall
    digitall avatar
    169 posts
    Member since:
    Jun 2006

    Posted 12 Oct 2011 Link to this post

    Wrap your script in a RadCodeBlock like this:
    <telerik:RadCodeBlock runat="server">
         <script language="javascript" type="text/javascript">
              <!-- JS here -->
         </script>
    </telerik:RadCodeBlock>

    That resolves the error you are receiving. Anytime you do JS with controls that have been AJAX-ified you have to use this method or you'll receive the error you are seeing now.
  29. Velmurugan
    Velmurugan avatar
    37 posts
    Member since:
    Aug 2011

    Posted 13 Oct 2011 Link to this post

    hi ....thanks for ur response..

         but itz working but i can't select all checkbox when clicking the header text...
  30. Velmurugan
    Velmurugan avatar
    37 posts
    Member since:
    Aug 2011

    Posted 18 Oct 2011 Link to this post

    hiii.....

                 i have two columns like grideditbuttoncolumn( add),Gridbuttoncolumn(delete).
               how to set visible false programmatically at pageload.......help me
Back to Top