-2

I'm using Oracle and I have this in my model

public string Completed { get; set; }  

I guess there's no bool in Oracle. I tried

@Html.CheckBoxFor(model => model.completed) 

And

@Html.CheckBox("Completed")
Bosco
  • 1,536
  • 2
  • 13
  • 25
Mavi
  • 1
  • 2
  • I'd suggest using a different datatype than string: https://stackoverflow.com/questions/2426145/oracles-lack-of-a-bit-datatype-for-table-columns – computercarguy Jul 11 '19 at 17:05
  • Having a question mark in your property name should throw an error. – jPhizzle Jul 11 '19 at 17:05
  • can you give us an example of what checkbox value you're trying to pass? eg. "yes" "no" "maybe so" – jPhizzle Jul 11 '19 at 17:06
  • @jPhizzle The question mark is only in the label tag to display. How do I pass a value? I want to pass Y or N instead of true and false. The data type is set as VARCHAR2(1 Byte) – Mavi Jul 11 '19 at 17:14
  • [Maybe try this](https://stackoverflow.com/questions/14730746/getting-checkbox-value-in-asp-net-mvc-4) – jPhizzle Jul 11 '19 at 17:23
  • Doesn't solve the issue. I have a 1 byte string as data type not a bool – Mavi Jul 11 '19 at 17:42

1 Answers1

0

This is what worked for me

<input id="completed" type="checkbox" value="Y" name="completed">
<input type="hidden" value="N" name="completed">
Mavi
  • 1
  • 2