If what is put into that cell is actually just an int
, use:
(int)item["QuestionId"]
Otherwise, check the runtime type of the value item["QuestionId"]
, if it is a byte
for example, use (byte)item["QuestionId"]
. If you're not sure, then:
Convert.ToInt32(item["QuestionId"])
will probably work, but that's less elegant.