Handling client event OnRowResized in server-side

3 posts, 0 answers
  1. Virgil Rodriguez
    Virgil Rodriguez avatar
    70 posts
    Member since:
    Oct 2008

    Posted 19 Dec 2011 Link to this post

    Hello Telerik,

    I'm sorry, I should have posted this in the RadGrid section of the forum, but I was using RadDock within a RadGrid, that's why I instinctively posted this in the RadDock section.

    Anyways ... I hope you won't mind ... Thanks.

    How do you pass back to the server the event args in a OnRowResized event on the client-side?

    I got it to work in a OnRowClick event by having this statement in my code behind:

     

    RadGrid1.ClientSettings.EnablePostBackOnRowClick = True

    RadGrid1.ClientSettings.ClientEvents.OnRowClick = "On_Row_Click"


    AddHandler
    RadGrid1.ItemCommand, AddressOf RadGrid1_ItemCommand

     


    And in my .ASCX I have this:

     

    function On_Row_Click(sender, eventArgs) {

      __doPostBack(sender.ClientID, "RowClicked:" + eventArgs.get_itemIndexHierarchical());

    }

     

     

    When a row is clicked, it runs the __doPostBack command above and I catch the postback on the server side in my code behind:

     

    Private Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)

       'Client-side event is caught here !!!

    End Sub

     

     


    How do I accomplish the same thing for a client-side OnRowResized event?

    If anyone can give a quick response (or a working example), it would be highly appeciated.

    Thanks.


  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 20 Dec 2011 Link to this post

    Virgil:

    I am able to capture the event args from the OnRowResized client-side event in my application by specifying the following <ClientSettings> for my RadGrad:

    <ClientSettings>
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        <Resizing ShowRowIndicatorColumn="true" AllowRowResize="true" EnableRealTimeResize="True"/>
        <Selecting AllowRowSelect="True" />
        <ClientEvents OnRowResized="OnRowResized" />
    </ClientSettings>

    and the following javascript event handler:

    <script type="text/javascript">
        function OnRowResized(sender, eventArgs) {
     
            __doPostBack(sender.ClientID, "Resizing row instance: " + eventArgs.get_itemIndexHierarchical());
        }
     
    </script>
     
    I am able to capture the arguments on the server side.

    Cheers!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Virgil Rodriguez
    Virgil Rodriguez avatar
    70 posts
    Member since:
    Oct 2008

    Posted 21 Dec 2011 Link to this post

    Hi Jumpstart,

    Thanks for your input. But, how do you trap the event on the server side after you do a __doPostback() on the client side?

    I was expecting the event to be captured by this on the server-side, but it did not:

    Private Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)

       'Client-side event is caught here !!!

    End Sub


    What am I missing?

    Thanks again.


     

Back to Top