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

Deselected Row when change page in WebServices DataBinding

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kronnos_indigo
Top achievements
Rank 2
kronnos_indigo asked on 16 Jun 2009, 09:37 PM
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!

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 19 Jun 2009, 02:54 PM
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.
0
kronnos_indigo
Top achievements
Rank 2
answered on 24 Jun 2009, 12:46 PM
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
0
Sebastian
Telerik team
answered on 26 Jun 2009, 01:54 PM
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.
Tags
Grid
Asked by
kronnos_indigo
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
kronnos_indigo
Top achievements
Rank 2
Share this question
or