2015-09-10 24 views

回答

0

您可以使用RadioButtonList對象的ID屬性來執行此操作,只要事件觸發時獲取sender對象的ID即可。

protected void RadioButtonList_SelectedIndexChanged(object sender, EventArgs e) 
{ 
    string listName = ((RadioButtonList)sender).ID 
    // listName = RadioButtonList1 or RadioButtonList2 or whatever the ID is set to. 

    if (listName == "RadioButtonList1") 
    { 
     // Rest of your code goes here, now that you know which RadioButtonList the event was fired from 
    } 
} 
+0

好的,這是一個好主意。謝謝! – dawsoad

相關問題