I have an ASP.NET 4.0 application. In the application we want to allow the user to select the revision of a document they’ve read.
Right now the codes are along the lines of:
AA
AB
AC
BA
BB
BC
In this case, AA is revision one and BC is revision 6.
What I want to do is check that the value a user is entering in a textbox is of the current revision or lower.
Is this as simple as a string comparison, or is there more to it? I was thinking of using a CustomValidator and server-side code.
It doesn’t sound like a simple string-comparison will do it: using your example above, “AZ” would sort before “BC”. Thus, it would be considered “earlier” from a sorting perspective, but is probably not a valid value for the user to select.
If you know all the valid revisions of the document at hand, you’re probably better off simply confirming that the user’s value is in the list. Or maybe even letting them choose (via DropDownList) only valid values, rather than letting them type in any ol’ string.