Client side SelectedRows

4 posts, 0 answers
  1. Pierre
    Pierre avatar
    212 posts
    Member since:
    Apr 2007

    Posted 15 Dec 2008 Link to this post

    Hi, after updating to the last version, this client code stop fonctionning:

     

    for (var i = 0; i < grid.MasterTableView.SelectedRows.length; i++)

     

    {
        ... 

     

     

     

    }

    i got a not defined error on the MasterTableView
    I try this:

    for

     

    (var i = 0; i < grid.get_masterTableView().SelectedRows.length; i++)

     

     

    {
        ... 

     now i got this objet do not have this properties.

    any suggestion? Thanks

     

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 16 Dec 2008 Link to this post

    Hello Pierre,

    Here is an example:

    for (var i = 0; i < grid.get_masterTableView().get_selectedItems().length; i++)
    {
        // your code goes here
    }

    Greetings,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pierre
    Pierre avatar
    212 posts
    Member since:
    Apr 2007

    Posted 16 Dec 2008 Link to this post

    I got the same error: here all the function. Can you help my to convert it correctly?

                function OnLogoChange(sender, eventArgs)  
                {  
                   <telerik:RadCodeBlock runat="server">  
                   var grid = window["<%= RadGridComm.ClientID %>"];  
                   </telerik:RadCodeBlock> 
                     
                     
                     
                   for (var i = 0; i < grid.get_masterTableView().get_selectedItems().length; i++)  
                    {     
                        var Row = grid.get_masterTableView().get_selectedItems()[i];  
                        var ID = grid.get_masterTableView().GetCellByColumnUniqueName(Row, "ID");  
                        var oWindow = radopen ("/Site/Usager/ChangePhoto.aspx?sUID=" + ID.innerText + "&sType=Logo", "ChangeLogo");  
                    }    
                                    
                } 
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 16 Dec 2008 Link to this post

    Hi Pierre,

    I looked at your code and here are my findings:
    • The RadCodeBlock control should not be placed inside a client function. It should surround the <script> tag. Find more infomration about RadCodeBlock here.
    • In order to access the grid client-side object, you need to use the $find() method as described here.

    Please try modifying your code as below and let me know if it makes any difference:

    <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">  
    <script type="text/javascript">     
    function OnLogoChange(sender, eventArgs)     
    {     
        var grid = $find("<%= RadGridComm.ClientID %>");     
        for (var i = 0; i < grid.get_masterTableView().get_selectedItems().length; i++)     
        {        
            var Row = grid.get_masterTableView().get_selectedItems()[i];     
            var ID = grid.get_masterTableView().GetCellByColumnUniqueName(Row, "ID");     
            var oWindow = radopen("/Site/Usager/ChangePhoto.aspx?sUID=" + ID.innerText + "&sType=Logo""ChangeLogo");     
        }                                       
    }  
    </script>  
    </telerik:RadCodeBlock> 

    All the best,
    Iana
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top