【发布时间】:2013-10-30 14:35:23
【问题描述】:
我正在使用 C# Web 应用程序。我有一个包含 4 列的 DataGrid。三列是标签,一列是 DropDownList。在我的 ddl_SelectedIndexChanged 中,我希望能够从我的 DDL(单元格 [3])中获取选定的值并将其放在同一行的单元格 [2] 中。
这就是我所拥有的:
protected void ddlMachId_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;
string val = ddl.SelectedValue.ToString();
TableCell cell = ddl.Parent as TableCell;
DataGridItem item = cell.Parent as DataGridItem;
item.Cells[2] = val;
}
这给了我一个错误,说 item.Cells[2] 是只读的。
有什么想法吗?谢谢。
【问题讨论】:
标签: c# asp.net .net datagrid html-select