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

Handling client event OnRowResized in server-side

2 Answers 75 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Virgil Rodriguez
Top achievements
Rank 1
Virgil Rodriguez asked on 19 Dec 2011, 05:20 PM
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 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 20 Dec 2011, 08:14 PM
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!

0
Virgil Rodriguez
Top achievements
Rank 1
answered on 21 Dec 2011, 03:56 PM
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.


 

Tags
Dock
Asked by
Virgil Rodriguez
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Virgil Rodriguez
Top achievements
Rank 1
Share this question
or