Is there an enumeration in .net that corresponds to the basic command names such as Edit, Update, Delete
I'm using a Details view control 开发者_StackOverflowthat programatically switches modes by assigning OnItemCommand the following
OnItemCommand="dvCapability_ItemCommand"
In my method I check for the string equivilent of "Edit", "Insert", ""Delete" In order to reduce the potential for typos and reduce redundant work I created a static constant class that contains constants for the listed strings.
Does any one know if .Net has an enumeration that corresponds to these values or must we custom programe them. Any alternative suggestions would help as well.
I am not aware of any Enumeration for this, but I don't think it's necessary since the idea of handling an ItemCommand is that you don't necessarily have a command with either Insert/Update/Delete/Add values but something flexible enough as to allow you to define a command such as OnItemCommand="dvCapability_ItemCommand" CommandName="InsertAndNotify
or "OnItemCommand="dvCapability_ItemCommand" CommandName="InsertOnly
, etc., etc.
If you think you need to have that as a form of an Enumeration, you can create it and define your valid actions there.
精彩评论