作者:
renmax (竹科å¸å‹å“¥)
2016-02-16 15:12:06請輸入專案類型(網站專案或者應用程式專案):VB.net VS2015
各位版友好
最近剛好在實作GridView相關,在.aspx檔內已增加
<asp:GridView ID="GridView1" ...... AutoGenerateEditButton="True" ...... >
.vb內也已增加以下code
Protected Sub GridView1_RowUpdating(......) Handles GridView1.RowUpdating
......
Dim ck As CheckBox =
CType(GridView1.Rows(e.RowIndex).Cells(2).Controls(0), CheckBox)
......
End Sub
現在除了上述CheckBox的功能外,想新增可以修改文字Cells(1)內容的功能
意思就是按下"編輯"按鈕後,可以一次執行CheckBox和修改文字的兩種功能
有想過直接加上
Dim tb As TextBox =
CType(GridView1.Rows(e.RowIndex).Cells(1).Controls(0), TextBox)
但會出現錯誤,卻不知道原因是什麼@@"
爬過相關文章,好像可以使用RowEditing事件
但"編輯"這按鈕該怎麼判斷是執行RowUpdating或RowEditing呢?
謝謝