我正在使用 Gridview 来显示一些数据。在gridview 的EditItemTemplate 中,我将DropDownList 用于gridview 的列之一。gridview 的 DataSource 是一个表“UserEntries”。Dropdown的Datasource是另一个表“TypeEntries”。TypeEntries 的列是 - Guid 和 TypeName。Guid 是下拉列表的 DataValueField,TypeName 是 DataTextField。我将下拉菜单的 DataValueFiels 存储在 UserEntries 表中。
现在,当用户单击 gridview 的编辑按钮时,如何使用“TypeEntries”表填充下拉列表?我在用
Dropdownlist tempddl = new Dropdownlist();
tempddl = (Dropdownlist)gvUserData.FindControl("ddlTypeListInGrid");
tempddl.DataSource = _section.GetTypeEntries();
tempddl.DataBind();
但它不工作。谁能告诉我任何其他方式来完成这项任务?提前致谢。