IQueryable with RadioButtonList.SelectedValue
本文关键字:SelectedValue RadioButtonList with IQueryable | 更新日期: 2023-09-27 18:26:18
我可以使用IQueryable
中RadioButtonList
中的选定值来从表中获取选定值吗?
我有RadioButtonList
和DataValueField="Code"
我的代码是
public IQueryable<Tbl_name> GetValuesfromTable()
{
return dbo.Tbl_name.Where(q => q.Code = (RadioButtonList.SelectedItem.Value)).OrderBy(c => c.Date_publication);
}
你能帮我查询一下吗?
如果您想从该表中获取单个值。我正在考虑将Code
序列化为int:
public IQueryable<Tbl_name> GetValuesfromTable()
{
var selectedCode = Convert.ToInt32(RadioButtonList.SelectedValue);
return dbo.Tbl_name.Where(q => q.Code == selectedCode)
.OrderBy(c => c.Date_publication);
}