我的 aspx 页面上有两个 radgrids:Log 和 LogDetails。
当我单击日志网格上的一行时,我希望 LogDetails 使用 LogGrid 的 logid 刷新。但细节网格并不令人耳目一新。
请帮我。这是我的代码。谢谢
protected void OnLogGridNeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
var logs = LogManager.FindLog();
var sortedlogs = from l in logs
orderby l.LogId descending
select l;
grdLogGrid.DataSource = sortedlogs;
}
protected void OnLogDetailGridNeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
int logid = 0;
if (grdLogGrid.SelectedValue != null)
logid = Convert.ToInt32(grdLogGrid.SelectedValue.ToString());
var logDetails = LogManager.FindLogDetail();
var logDetail = from ld in logDetails
where ld.LogId == logid
select ld;
grdLogDetailGrid.DataSource = logDetail;
}
protected void OnLogGridItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
grdLogDetailGrid.Rebind();
}