iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
How can I invoke the Serve Side Event InitializeLayout programmatically?
I have put WebGrid 7 in a User Control .ascx. Depending on how the User Control Properties are set, I want to set the WebGridColumn Properties DefaultValue and EditType.
I have the WebGrid User Control in a GridView Template Column and set the UserControl Properties in the GridView Server Side Event RowDataBound.
The GridView.DataBind causes the WebGrid Side Event InitializeLayout to fire before the GridView Server Side Event RowDataBound which means the User Control Properties have not been set yet. A lot of this probably has to do with Catch-Up Events as documented in here:
http://msdn.microsoft.com/en-us/library/ms178472.aspx#catch_up_events_for_added_controls
I have tried set the WebGridColumn Properties in the WebGrid Server Side Events PreRender and PrepareDataBinding but it does not help.
Due to other issues discussed in this forum previously, I am already doing a WebGrid RebindDataSource in the User Control's Page_PreRender.
Is there a way to invoke the Serve Side Event InitializeLayout programmatically after the I know the User Control Properties have been set?
Or is there somewhere else I can set the WebGridColumn Properties Dynamically?
Thanks,
Doug
Setting the WebGridColumn.DefaultValue worked in OnAfterInitialize
I was finally able to call the WebGridCell.SetForceNoEdit Method in OnAfterInitialize but it didn't stick.
I found this post and was able to get SetForceNoEdit to work in the SetForceNoEdit OnRowSelect.
http://www.intersoftpt.com/Community/WebGrid/Tab-ForceNoEdit/
Hi Douglas Badin,
Usually, we can only set the WebGrid column property dynamically in server side event of PrepareDataBinding and InitializeLayout. In your case, could you kindly try to use these block of code.
WebGrid1.ClearCachedDataSource(); WebGrid1.RebindDataSource();
These code, ClearCachedDataSource and RebindDataSource, are used to clear cached data source and rebind the datasource. That is why, it is also can help us to re-triggered the server side InitializeLayout event.
I hope it helps. Thank you and have a nice day.
Best Regards,
Andi Santoso
Hi,
That does not cause the InitializeLayout or PrepareDataBinding to fire again.
Like I said before, I was already doing a RebindDataSource in the User Control's Page_PreRender. Doing ClearCachedDataSource() before RebindDataSource did not help.
Any other thoughts?
The issue has been discussed further in Live Chat. Since the goal is to modify the ability to enable or disable edit of a row or cell, using client side event handler OnAfterInitialize is possible to achieve such feature.
The client side function to disable edit is SetForceNoEdit(true), which could be applied to WebGrid cell object or WebGrid row object. Here is the snippet to disable first row in WebGrid and column Author in second row of WebGrid:
grid.RootTable.GetRow(0).SetForceNoEdit(true);grid.RootTable.GetRow(1).GetCell('Author').SetForceNoEdit(true);
Glad to hear that the issue has been solved.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname