我有一個網格視圖將兩個不同的按鈕列。我想根據用戶按下的按鈕執行不同的操作。 SelectedIndexChanged事件如何確定按下了哪個列。這是我用來生成列的代碼。GridView控件上的兩個按鈕列
grdAttachments.Columns.Clear();
ButtonField bfSelect = new ButtonField();
bfSelect.HeaderText = "View";
bfSelect.ButtonType = ButtonType.Link;
bfSelect.CommandName = "Select";
bfSelect.Text = "View";
ButtonField bfLink = new ButtonField();
bfLink.HeaderText = "Link/Unlink";
bfLink.ButtonType = ButtonType.Link;
bfLink.CommandName = "Select";
bfLink.Text = "Link";
grdAttachments.Columns.Add(bfSelect);
grdAttachments.Columns.Add(bfLink);
謝謝,我做了更多的搜索後發現了答案。 Bob – 2010-06-16 20:54:21