Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2165
Set default value with Razor
posted

I have tried to set a default value for a number column like this:

   pCs.ColumnSetting().ColumnKey("StyleKey").DefaultValue(@Model.Pk);  // doesn't works.
   pCs.ColumnSetting().ColumnKey("StyleKey").DefaultValue(Model.Pk);    // doesn't works either.

but that produce error. The only thing that works is:

   pCs.ColumnSetting().ColumnKey("StyleKey").DefaultValue(@Model.Pk.ToString()); // this works but I want a number, not string.

but StyleKey is number and that renders a string.

How to set a default number value using razor?

Parents Reply Children