DataGrid控件中加了一个DropDownList怎么判断我改变当前的DropDownList了?Asp.net 3.5 C#
index.aspx代码
<asp:DataGrid ID="DG" runat="server">
<Columns>
<asp:BoundColumn DataField="id" ></asp:BoundColumn>
<asp:DropDownList ID="DDL" runat="server" AutoPostBack="True" onselectedindexchanged="DDL_Changed">
<asp:ListItem Value="0">N</asp:ListItem>
<asp:ListItem Value="1">Y</asp:ListItem>
</asp:DropDownList>
</Columns>
</asp:DataGrid>
index.aspx.cs代码
protected void DDLData_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList TheDDL;
string ID="";
string DDLSelValues;
foreach (DataGridItem item in DG.Items)
{
TheDDL = (DropDownList)item.FindControl("DDL");
DDLSelValues = TheDDL.SelectedValue.ToString();
ID = item.Cells[1].Text;
{
此处如何写代码显示出当前的ID
也就是判断出当然的哪个DDL值改变了
现在的程序是显示第一个的ID
Client.ResponseAlert(this, ID);
}
}
}
谢谢
Email:Anysend@vip.qq.com