[請益] 如何偵測Gridview裡頭的checkbox去引發程序
這是asp.net的網頁
目前我有張表
┌─┬─┬─┬─┬─┬─┬─┬─┐
│號│姓│遲│早│曠│圖│圖│圖│
│碼│名│到│退│課│1│2│3│
├─┼─┼─┼─┼─┼─┼─┼─┤
│01│ A│V │ │ │ │ │ │
└─┴─┴─┴─┴─┴─┴─┴─┘
試問我要如何去判斷因為遲到引發圖1的Visible="true"
Dim Checkbox1 As CheckBox =
CType(GridView1.Rows(i).Cells(2).FindControl("Checkbox1"), CheckBox)
Dim checkbox2 As CheckBox =
CType(GridView1.Rows(i).Cells(3).FindControl("checkbox2"), CheckBox)
Dim checkbox3 As CheckBox =
CType(GridView1.Rows(i).Cells(4).FindControl("checkbox3"), CheckBox)
Dim image1 As Image = CType(GridView1.Rows(i).Cells(5).FindControl("image1"),
Image)
Dim image2 As Image = CType(GridView1.Rows(i).Cells(6).FindControl("image2"),
Image)
Dim image3 As Image = CType(GridView1.Rows(i).Cells(7).FindControl("image3"),
Image)
可是如果我加上判斷式
if chechbox1.checked= true then
image1.visible=true
end if
這個樣子執行結果會是
並未將物件參考設定為物件的執行個體
描述: 在執行目前 Web 要求的過程中發生未處理的例外情形。請檢閱堆疊追蹤以取得錯
誤的詳細資訊,以及在程式碼中產生的位置。
例外詳細資訊: System.NullReferenceException: 並未將物件參考設定為物件的執行個
體
請問各位我該如何修改我的程式碼
我改了二天,看了很多網頁我還是不了解
拜託大家了(〒△〒)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.231.151.173
推
11/22 10:03, , 1F
11/22 10:03, 1F
→
11/22 14:33, , 2F
11/22 14:33, 2F
→
11/22 19:25, , 3F
11/22 19:25, 3F
推
11/22 20:07, , 4F
11/22 20:07, 4F
→
11/24 10:33, , 5F
11/24 10:33, 5F
→
11/27 12:48, , 6F
11/27 12:48, 6F
→
11/27 12:49, , 7F
11/27 12:49, 7F