2009-02-17 [ASP.NET][Event] Control event catch DATAROW Index in the GridView 3231 0 ASP.NET 2009-09-02 摘要:[ASP.NET]Control event catch DATAROW Index in the DataGridView protected void Button1_Click(object sender, EventArgs e) ...{ //Object轉換控制項型別 Button btn = (Button)sender; //尋找上層控制項(父控制項) //GridViewRow gvr = (GridViewRow)btn.Parent.Parent; DataCell dc = (DataCell)btn.Parent; GridViewRow gvr = (GridViewRow)dc.Parent; int intRowIndex = gvr.RowIndex; Response.Write("<script>window.open('SampleOrder(zh-TW).aspx?RowIndex=" + intRowIndex.ToString()+ "');</script>"); } ASP.NETControlButtonButton1_ClickClickDataGridViewEventRowIndexsender 回首頁