我想要jsonStr的值是

"{submitOfferResult: 0}"


相反,虽然它是

"{submitOfferResult: OFFER_ACCEPTED}"

//javascript
var jsonStr = "{submitOfferResult: <%=SUBMIT_OFFER_RESULT.OFFER_ACCEPTED %>}";

//c#
public enum SUBMIT_OFFER_RESULT
{
    OFFER_ACCEPTED = 0,
    QUALIFYING_OFFER_NOT_MET = 1,
    OFFER_ACCEPTED_NOT_HIGHEST_OFFER = 2,
    OSP_CLOSED = 3,
    AUTO_REJECTED = 4
}

最佳答案

您需要将枚举转换为数字类型:

(int)SUBMIT_OFFER_RESULT.OFFER_ACCEPTED

关于c# - 使用代码块渲染枚举值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16469065/

10-12 19:43