2011-12-18 50 views
-1

我正在Visual Web開發人員上創建一個社交網絡網站,並且我正在使用GridView生成所有組列表作爲按鈕加入此組。所以我如何訪問按鈕的動作偵聽器並將其他列的值傳遞給它?可視化Web開發人員2010中的GridView按鈕控件

+0

請修改你的標題是描述您遇到的問題。現在它是無用的。此外,請張貼您當前的代碼,因爲很難理解您要實現的目標。 – Oded 2011-12-18 20:29:00

回答

2

以及給出的信息我可以假設你的意思是傾聽GridView中生成的每個按鈕上的事件。

因此,你會做這樣的事情:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)  
{ 

    if (e.Row.RowType == DataControlRowType.DataRow)   
    { 
     // Get The button from which ever cell the button is in 
     Button1.Click += new EventHandler(Button1_Click); 


    } 

} 

void Button1_Click(object sender, EventArgs e) 
{ 

} 
相關問題