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
Hi,
This is related to adding programmatically a CellTemplate to webgrid. A solution was given for a similar question on this thread.
However, I need to support both templates and paging, and as soon as I enable paging and go to some other page (than the first one, and even later, when returning to the first page) the content from the celltemplate is gone.
I tried this by adding the solution given on the zip for that thread to the WebGridSamples project that comes with the suite.
Thanks
Hi Guillermo,
Yes, if we use Classic Paging in the WebGrid, we cannot create the new cellTemplate in PrepareDataBinding since the WebGrid's life cycle only ignites the function once in the beginning. To have the label appears in the next page of classic paging, we need to set it on InitializeLayout. You can remove the code in PrepareDataBinding and put these following code on your InitializeLayOut. So that, the layout will be re-initialize after we go to the next page. Here is the snippet:
if (WebGrid1.RootTable.Columns.GetNamedItem("test") == null) { WebGridColumn newColumn = new ISNet.WebUI.WebGrid.WebGridColumn(); newColumn.ColumnType = ISNet.WebUI.WebGrid.ColumnType.Template; newColumn.CellTemplate = new cellTemplate(); newColumn.Name = "test"; newColumn.Width = 300; newColumn.Caption = "Templated Column"; WebGrid1.RootTable.Columns.Add(newColumn); } else { WebGrid1.RootTable.Columns.GetNamedItem("test").CellTemplate = new cellTemplate(); }
I hope it solves your problem and please, do not hesitate to ask if you have any other questions. Thank you.
Best Regards,
Andi Santoso
Thanks Andi, effectively I have to create the column onInitializeLayout and don't check for the postback to make it persist while paging.
Yes it is. Glad to hear that it solves your problem. Please do not hesitate to ask if you have any other questions. Thank you.
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