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
I have a webgrid bound to an ObjectDataSource which returns my business entities. In these objects I have enums which are displayed with their int value in the WebGrid column.
enum MyEnum{A = 0,B = 1,..}
Is there a way to have a dropdown in the column that has the string representation as text ("A", "B", ...) and the int value as value. and which allows to add a new row including the correct transformation to the enum?
thank you
For such scenario you will need to use the WebValueList feature in our WebGrid as shown in IntegrationwithWebCombo.NET.aspx WebGrid provide sample and explained in the article Walkthrough: Using WebValueList in WebGrid in the WebGrid documentation.
WebValueList will accept text - value construct for example hast table or datatable, so you will need to convert the Enum. Here is the snippet to convert the Enum into HashTable:
Hashtable htEnum = new Hashtable();foreach (object val in Enum.GetValues(typeof(TestList))){ htEnum.Add((int)val, val.ToString());}
public enum TestList{ A = 0, B = 1, C = 2, D = 3}
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