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
We have a scenario where we have a DropDownList in a CellTemplate with values that we would like the user to be able to select. This works just fine, actually, except that when the user sorts or pages or interacts with the grid such that there is a FlyPostback (or full PostBack), the changes are lost. This is different from the behavior in the other cells, where the changed value is retained across Fly and full postbacks. How do we enable such state changes for celltemplates? I looked at the post below and even ran the sample but the sample, despite displaying a grid with the dropdownlist, does not retain the changes when the grid is sorted or paged.
Thanks,
Brad
http://www.intersoftpt.com/Community/WebGrid/How-do-I-initailly-set-the-WebGrid-in-Edit-Mode/
Thanks Yudi. I was able to work with this code to achieve my goal here. You had:
cells.GetNamedItem("Legal").SetText(val, true); cells.GetNamedItem("Legal").SetText(val); row.SetDataChanged(); WebGrid1.MarkEdit();
I changed it to:
cells.GetNamedItem("Legal").SetText(val, true); row.Update();
Using Update() worked a bit better for our situation and I didn't want to call SetText() twice. I wasn't sure if you intended to call it twice for some reason or if it was a mistake but I took out the second call and it worked fine.
Thanks again,
When using the Template Column Type, you can put any server side controls inside the CellTemplate property of the WebGridColumn. However, editing is not affected with Templated Column. This means that we will still need to handle the insert, update, and delete event through the template column.
I enclosed one simple sample of WebGrid with template column. The grid is bind to ‘Customers’ table of Northwind database. ‘ContactTitle’ column uses template column where ASP.Net DropDownList is put inside the CellTemplate of the column.
When users click the DropDownList control and modify the selected value, WebGrid is actually not accepting the changes directly. We will need to set the text and the value of the corresponding modified cell and inform WebGrid that there are changes within the row. So, when users move the focus off the row, WebGrid will validate the row and accept the changes.
The attached sample is only a simple sample that handles simple editing action. By handling this, the changed value is retained both on FlyPostBack and Full PostBack. For more detail information, please check the attached sample.
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