看板 Visual_Basic 關於我們 聯絡資訊
請輸入專案類型(網站專案或者應用程式專案):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呢? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.216.21.87 ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1455606728.A.C89.html ※ 編輯: renmax (61.216.21.87), 02/16/2016 15:25:48
ian90911: rowediting好像是是rowcommand=edit觸發 02/17 13:18
ian90911: CommandName="Edit" CommandName="Update" 02/17 13:22
ian90911: 按下編輯前是ItemTemplate 按下後是EditItemTemplate 02/17 13:23
JohnYaEPen: 出現什麼錯誤訊息 02/19 08:23
renmax: 已找到方法 原因是將ReadOnly="false"即可 謝謝 02/19 17:01