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
  • 23953
    Suggested Answer
    Offline posted

    Hello Luis,

    Currently the DefaultValue method accepts string as an argument. When tested this scenario on my end I didn't notice any problems in the functionality in the browser.
    What is the problem that you observe? 

    Thanks in advance,
    Martin Pavlov
    Infragistics, Inc. 

Reply Children