RT,非常奇怪
<ItemStyle Width="182px"></ItemStyle>
<ItemTemplate>
asp:DropDownList Runat="server" ID="DropDown" AutoPostBack="True" OnSelectedIndexChanged="dl_SelectedIndexChanged"
EnableViewState="False"></asp:DropDownList>
</ItemTemplate>///ItemCreat函数//////////
private void OnItemCreat(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
    if(e.Item.ItemType==ListItemType.AlternatingItem||e.Item.ItemType==ListItemType.Item)
    {
try
{ DropDownList dw=(DropDownList)e.Item.FindControl("DropDown");
dw.SelectedIndexChanged+=new EventHandler(dl_SelectedIndexChanged);
}
catch(Exception ex)
{
}
    }
}结果怎么也不触发
protected void dl_SelectedIndexChanged(object sender, EventArgs e)
{
   BindLabel();}怎么回事??

解决方案 »

  1.   

    的确不会激活;你用DataGrid的ItemCommand事件
    private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
        string strDeposit_id,strScript;
        if (e.CommandName.Trim()=="save" )
        {
        }
    }
      

  2.   

    好像在DATAGRID中的控件本身的事件都不能激活;当然你要是找到了办法,给偶也发一个消息过来。
      

  3.   

    不行,用ItemCommand依然不能捕捉到dropdownlist的SelectChange事件,怎么回事?
    哪位知道的说一下啊
      

  4.   

    一般来说我不知道你要这个功能干什么?你可以放到datagrid外面不就行了
      

  5.   

    因为每行都有个dropdownlist,所以必须放在里面,主要是要实现一些联动效果
      

  6.   

    将dropdownlist的commandname设置为select