Deselected Row when change page in WebServices DataBinding

4 posts, 0 answers
  1. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 16 Jun 2009 Link to this post

    Good afternoon Team Telerik.

    I have a problem when change the page in Grid databing with Webservices Technique:

    When select a row and change the page, the grid keep the row selected previusly.  I search for all events and clients events for deselected it but I don´t find any method for this at .ASPX.VB or ASPX. Can You Help me??


    Juan Pablo Díaz
    Rentabyte Ltda.

    I need this urgently, Thanks!
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 19 Jun 2009 Link to this post

    Hello kronnos_indigo,

    In order to deselect the previously selected row when you navigate to a different page and using client-side binding, consider the following steps:
    • intercept the OnCommand client event of the grid (detecting the paging by the args.get_commandName() argument passed in the handler)
    • traverse the grid items in the master table
    • invoke the deselectItem(index) client method for each of them
    Best regards,
    Sebastian
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 24 Jun 2009 Link to this post

    God Mornig Sebastian.

    Thank by answer but I don´t understand the processes to apply the solution rigthly. If You have an example for attach to this message, I would thank for it.

    To add...  I can run the solution but the grid don't change the page. For example if I select a row in first page and change to another, the grid stay in page one and the row is selected.
    The Steep that I follow are the next:
    1. In ClientEvents of Grid 'gvpuc' are add:
    <ClientEvents OnRowSelected="SeleccionarCuenta" OnCommand="ComandoGrilla" /> 
      <DataBinding FilterParameterType="String" Location="HNIPUC_a00a.asmx"    
             SelectCountMethod="GetCount" SelectMethod="GetDataAndCount"  SortParameterType="String"
     </DataBinding> 
    </ClientSettings> 

    2. I create the function ComandoGrilla
    function ComandoGrilla(sender, args) { 
        var masterTable = $find("<%= gvpuc.ClientID %>").get_masterTableView(); 
        masterTable.deselectItem(masterTable.get_dataItems()[0].get_element()); 
        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("ComandoGrilla"); 
      } 
    3. In VB, Method AjaxRequest (update two controls of page):
    If e.Argument = "SeleccionarCuenta" Then 
      p = 10 : gvCrDb.DataBind() 
      p = 20 : CargarGrillaDbCr() 
      p = 90 : gvCrDb.Visible = True 
      p = 91 : lbCuenta.Text = "Cuenta: " & hfcodCuentaAplicar.Value & "-" & hfNombreCta.Value & " Año: " & hfano.Value 
      p = 95 : lbCuenta.Visible = True 
    End If 
    If e.Argument = "ComandoGrilla" Then 
      p = 100 : hfano.Value = CType(Me.SeleccionNivelAno1.FindControl("hfano"), HiddenField).Value 
      p = 120 : hfNivelCta.Value = CType(Me.SeleccionNivelAno1.FindControl("rblnivel"), RadioButtonList).SelectedValue 
      If gvpuc.SelectedItems.Count > 0 Then 
        ' gvpuc.Items(gvpuc.SelectedIndexes(0)).Selected = False 
      End If 
    End If 

    If I want change the page without select row, the grid made any steeps and return to first page. Can You help for this???

    Juan Pablo
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 26 Jun 2009 Link to this post

    Hello kronnos_indigo,

    For your convenience I prepared a sample demo which illustrates the approach. You will find it attached to this forum thread. Note that it uses the clearSelectedItems client method to simplify the client code additionally.

    Kind regards,
    Sebastian
    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.
Back to Top