protected void gvdet_DataBound(object sender, GridViewRowEventArgs e)
{
string employeeName = dsOLDData.SelectedItem.Text; -- ERROR HERE :(
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell c in e.Row.Cells)
{
if (c.Controls[0] is DataBoundLiteralControl)
{
DataBoundLiteralControl ctl = (DataBoundLiteralControl)c.Controls[0];
if (ctl.Text.Contains(employeeName))
{
c.BackColor = System.Drawing.Color.Yellow;
c.ForeColor = System.Drawing.Color.Blue;
}
}
}
}
}
}
ERROR: 错误2“System.Web.UI.WebControls.LinqDataSource”不包含关于“的SelectedItem”和没有扩展方法“的SelectedItem”接受型的System.Web.UI的“第一自变量的定义。 WebControls.LinqDataSource'可以找到(你是否缺少使用指令或程序集引用?)错误:缺少使用指令或程序集引用?
什么是dsOLDData?它是一个数据集?下拉列表?我们需要更多细节,否则我们无法帮助您。 – 2009-08-07 19:06:40
嗨大卫,我很欣赏编辑。希望我能得到一个有用的解决方案。 – Yves 2009-08-07 19:07:01
是的大卫,它是一个下拉列表 – Yves 2009-08-07 19:07:43