1

在 ASP.Net VB.Net 代码隐藏文件中,您能告诉我在 DetailsView 显示空白项(例如 DropDownLists)时,当用户单击 DetailsView 的“新建”按钮时我可以使用哪些事件触发,文本框等?

我需要使用此事件处理程序在从变量获得的 DropDownList 中预选一个值。

4

1 回答 1

2

尝试 ItemCommand 事件。这是如何使用它。我只知道 C# ,但我想你已经掌握了窍门。

后面的代码:

protected void DetailsView_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
    if (e.CommandName == "New")
    {
        // Your code here
    }
}

标记:

<asp:DetailsView ID="DetailsView" runat="server" OnItemCommand="DetailsView_ItemCommand" ...
于 2013-01-04T17:46:02.230 回答