假設在 GirdView 欄位的 ItemTemplate 中放置 CheckBox 控制項,然後設定該 CheckBox 的 AutoPostBack 為 True,希望在 CheckBox 的CheckedChanged 事件撰寫相關程式碼。

*.aspx 的程式碼如下

一般在 CheckBox 的 CheckedChanged 事件需要它是由那個資料列的 CheckBox 所引發的 PostBack。可以撰寫如下的程式碼,取得控制項所屬的 GridViewRow 及 RowIndex。

ASP.NET 魔法學院


DotBlogs Tags: GridView GridViewRow RowIndex

Feedback

目前沒有回應.
標題 *
名稱 *
Email (將不會被顯示)
Url
回應
登入後使用進階評論
Please add 2 and 5 and type the answer here: