显示单选按钮的搜索结果 [英] display search result from radio buttons
本文介绍了显示单选按钮的搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我显示数据库结果时,单选按钮总是返回
即使在数据库中是"Male",也要是"Female".
帮帮我
when ever i display a result from my database, the radio buttons alway returns
"Female" even if it is "Male" in the database.
help me out
if (person.sex.ToString() == "Male")
{
optMale.Checked = true;
}
else
{
optFemale.Checked = true;
}
推荐答案
问题出在其他地方.这并不意味着sex.ToString()
返回女性",它根本就不会返回男性".通常,无论如何与字符串的比较都是草率的.在所有情况下都使用调试器.
—SA
The problem is somewhere else. It does not mean thatsex.ToString()
returns "Female", it simply never returns "Male". Generally, comparison with a string is pretty sloppy anyway. Use the Debugger in all cases.
—SA
这篇关于显示单选按钮的搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文