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

Telerik radgrid attaching oncommand client event messes up paging

1 Answer 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
cha
Top achievements
Rank 1
cha asked on 26 Mar 2011, 04:09 PM
I have a telerik radgrid with paging enabled and attaching the oncommand client event messes up paging.
Without the oncommand event, I am able to click on page numbers on the pager and it properly shows the selected page number text in bold.
But if I attach a oncommand event, it does not highlight the selected page number at all. And all the page numbers remain as hyperlinks including the selected page. Here is the sample code to reproduce this issue. Can some one please let me know if there is a fix ? I need to be able to trap the commands and cancel them if possible before postback happens to the server. And pagination is very critical for me as well. I tried to attach the oncommand event handler in the server side code(on page load event) but it doesnt help.

<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
  <script type="text/javascript">
      function onInqGridCmd(sender, eventArgs) {
      }
   </script>
</telerik:RadCodeBlock>   
 
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" EnableEmbeddedSkins="true" Skin="Gray" AllowSorting="True"
    AllowPaging="True" PageSize="5" runat="server" GridLines="None" Width="100%">
    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
    <ClientSettings>
        <Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true"   />
        <ClientEvents  OnCommand="onInqGridCmd"></ClientEvents>
    </ClientSettings>
     
</telerik:RadGrid>
 
<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM              Customers" runat="server"></asp:SqlDataSource>

Appreciate your help.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 29 Mar 2011, 09:23 PM
Hello Cha,

Client-side OnCommand event will behave properly only if you use client-side binding. Please note that this event is not designed to be used with server-side binding.

Regards,
Daniel
the Telerik team
Tags
Grid
Asked by
cha
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or