C# 对DropDownList更改执行更新

C# 对DropDownList更改执行更新,c#,gridview,asp.net-3.5,C#,Gridview,Asp.net 3.5,目前,我在ItemTemplate中有一个GridView,其中包含以下内容: <asp:LinkButton ID="lbEdit" runat="server" CommandName="Edit"> <asp:Label ID="Label6x" runat="server" Text='<%# Bind("progress_full") %>' /></asp:LinkButton> 这很好,当我单击它时,它会显示当前包含以下

目前,我在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,而不是我对下拉列表进行更改并必须单击
Update

您可以将
AutoPostBack=“true”
添加到您的下拉列表中并设置
=“DropDownList1\u SelectedIndexChanged”


您可以将
AutoPostBack=“true”
添加到DropDownList中,并设置
onSelectedInterchange=“DropDownList 1\u SelectedIndexChanged”


当前的
Update
link按钮使用
onrowupdateing
来自
GridView
onrowupdateing
函数中的
GridView行=(GridView行)GridView 1.Rows[e.RowIndex]
如果我将代码复制到
DropDownList1\u SelectedIndexChanged
函数中,则该函数无效。您可以迭代网格OSHIROWANENFORACH(此.dataGridView1.Rows中的DataGridViewRow行){foreach(row.Cells中的DataGridViewCell单元格){}当前的
Update
link按钮使用
onrowupdateing
来自
GridView
onrowupdateing
函数中的
GridView行=(GridView行)GridView 1.Rows[e.RowIndex]
如果我将代码复制到
DropDownList1\u SelectedIndexChanged
函数中,则该函数无效。您可以迭代网格OSHIROWANENFORACH(此.dataGridView1.Rows中的DataGridViewRow行){foreach(row.Cells中的DataGridViewCell单元格){}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
   //execute here your update
   ......
}