【发布时间】:2015-12-10 13:51:31
【问题描述】:
我可以在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);
}
请问您能帮我解决这个问题吗?
【问题讨论】:
-
为什么需要
OrderBy?您是否收到错误消息?什么错误? -
它确实有效:返回 dbo.Tbl_name.Where(q=>q.Code== 1) 。 Order by 不是必需的..但是我不能使用 RadioButtonList 中的值...
-
当您尝试使用 RadioButtonList 中的值时会发生什么?
-
我更新了答案,试试吧。
标签: c# asp.net code-behind iqueryable radiobuttonlist