We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Server side row selection, and post render client events

Sorry guys, more questions!

I am trying to make your MVC grid work like you might use a ListView in a Forms app, hence:

1. How do I select a row on initial display, server side essentially? None of your samples seem to do this.

2. How can I run some client-side code after my grid has rendered especially on an async partial render. If I could do this then I could fix issue 1., but I also I am trying to resize the height of the grid to fit the window. Shame there is no built-in 100% height resize functionality, as far as I can see, only 100% width.

Many thanks
Mark



5 Replies

ES Eswari S Syncfusion Team August 22, 2011 12:13 PM UTC


Hi Mark,

Thank you for your interest in Syncfusion products.

Query #1: MVC grid work like use a ListView.

We can achieve your requirement through column templates. Please refer to the online sample and UG links:

Online sample:

http://mvc.syncfusion.com/sfmvcsamplebrowser/9.3.0.61/Grid_MVC/Samples/4.0/Templates/ServerMode

UG :

http://help.syncfusion.com/ug_93/User%20Interface/ASP.NET%20MVC/Grid/default.htm?turl=Documents%2F522columntemplates.htm

Query #2 : How do I select a row on initial display

We can achieve your requirement through client side scripting.

To select the rows ,we can use selectRow(index)/selectAll() methods.

Please refer to the following code snippets:

[JavaScript]




Query #3: Resize the height of the grid to fit the window.

Grid Width will automatically change when window width is resized. To resize height , we can use $(window).resize function.

Please refer to the following code snippets:

[Aspx]

<%=Html.Syncfusion().Grid(" SampleGrid")
. . . .

%>


[JavaScript]



Please try this and let us know if you need any further assistance.

Regards,
Eswari.S





MT Mark Treveil August 22, 2011 08:17 PM UTC

Eswari,

Thanks, but my problem is not the code required to do the row select, or the height setting - I've got that. The problem is how to call it after a partial render. What event can I hook that triggers after a partial render.

The OnLoad event only works when the full page is loaded, as far as I can see. Similarly, I can resize the grid on load, and by using various events on the grid and window, such as OnActionSucess, I can resize after a re-sort.

However on both IE9 and on Chrome it is hard to get it to resize the grid on partial render.

Thanks
Mark



ES Eswari S Syncfusion Team August 23, 2011 11:36 AM UTC

Hi Mark,

Thanks for your update.

Query #1: The problem is how to call it after a partial render

We can achieve your requirement through OnActionSuccess event.

Please refer to the following code snippets:

<%=Html.Syncfusion().Grid("OrderGrid")

. . .

.ClientSideEvents(eve=>{
eve.OnActionSuccess("applicationLoadHandler");
})
. . .

%>


Query #2 : IE9 and on Chrome it is hard to get it to resize the grid on partial render

We are sorry for inconvenience caused. We are unable to reproduce the issue. We have prepared a simple sample and the same can be downloaded from the following link.

Sample-2089197905.zip

Note: If you want to run the sample in MVC3, change the configuration manager as Debug_MVC3/Release_MVC3.To briefly know about that steps please kindly refer this document link.

How to Switch between MVC2 to MVC3

Could you please try the above sample and get back to us whether you are able to reproduce the issue? If not, could you please give more information or by reproducing the issue in the above sample so that we could sort out the issue and provide you with solution. The information provided would be of great help in resolving the issue.

Please try this and let us know if you need any further assistance.

Regards,
Eswari.S






MT Mark Treveil August 25, 2011 08:44 PM UTC

Eswari S

Thanks. It looks like my problem here was the same as my sorting problem - returning PartialView(objlist) not objlist.GridObjects()

Once I'd fixed that, the OnActionSucess events seem to work OK.

Many thanks
Mark



ES Eswari S Syncfusion Team August 26, 2011 12:58 PM UTC


Hi Mark,

Thanks for the update.

Happy to hear that you have everything working . Do not hesitate to update if you have any questions.

Regards,
Eswari.S


Loader.
Live Chat Icon For mobile
Up arrow icon