add an ItemCommand handler for the DataList, then tryvoid DataList_ItemCommand(Object sender, DataListCommandEventArgs e) 
{
   int quantity =((DropDownList)e.Item.FindControl("QuantityDropDownList")).SelectedIndex+1;       
}

解决方案 »

  1.   

    ==>
    int quantity =((DropDownList)ProductDataList.SelectedItem.FindControl("QuantityDropDownList")).SelectedIndex+1;
      

  2.   

    To saucer(思归, .NET MVP) 不可以啊 
    因为我是使Button触发事件,
    如果给Datalist加了这个事件则根本不会触发啊 To  jjcccc()
    试过了,但由于是Button触发事件 SelectedItem根本好像就没有
      

  3.   

    加入asp:ButtonColumn,然后调用OnItemCommand事件,接着的就跟思归大侠说的那样了
      

  4.   

    用ButtonColumn,然后调用ITEMCOMMAND事件,接着就跟思归大侠说的那样了
      

  5.   

    怎么用ButtonColumn呢,有没有例子啊
    谢谢大家了:)