目前,我在ItemTemplate中有一个带有以下内容的GridView:
<asp:LinkButton ID="lbEdit" runat="server" CommandName="Edit">
<asp:Label ID="Label6x" runat="server" Text='<%# Bind("progress_full") %>' /></asp:LinkButton>
这很好用,当我点击它时,它会显示当前包含以下内容的EditTemplate:
<asp:DropDownList ID="DropDownList3" runat="server"
SelectedValue='<%# Bind("progress") %>'>
<asp:ListItem Value="0">In queue</asp:ListItem>
<asp:ListItem Value="1">Being worked on</asp:ListItem>
<asp:ListItem Value="2">Complete</asp:ListItem>
</asp:DropDownList><br />
<asp:LinkButton ID="lbUpdate" runat="server" CommandName="Update" Text="Update" />
如何让下拉列表在更改时自动执行Update
命令,立即返回到ItemTemplate,而不是我对DropDown进行更改并且必须单击Update
?
答案 0 :(得分:1)
您将AutoPostBack="true"
添加到DropDownList并设置OnSelecIndexChanged="DropDownList1_SelectedIndexChanged"
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//execute here your update
......
}