http://msdn.microsoft.com/zh-tw/library/system.web.ui.webcontrols.gridview.selectedrow(v=vs.110).aspx
Sub CustomersGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) ' Get the currently selected row using the SelectedRow property. Dim row As GridViewRow = CustomersGridView.SelectedRow ' Display the first name from the selected row. ' In this example, the third column (index 2) contains ' the first name. MessageLabel.Text = "You selected " & row.Cells(2).Text & "." End Sub Sub CustomersGridView_SelectedIndexChanging(ByVal sender As Object, ByVal e As GridViewSelectEventArgs) ' Get the currently selected row. Because the SelectedIndexChanging event ' occurs before the select operation in the GridView control, the ' SelectedRow property cannot be used. Instead, use the Rows collection ' and the NewSelectedIndex property of the e argument passed to this ' event handler. Dim row As GridViewRow = CustomersGridView.Rows(e.NewSelectedIndex) ' You can cancel the select operation by using the Cancel ' property. For this example, if the user selects a customer with ' the ID "ANATR", the select operation is canceled and an error message ' is displayed. If row.Cells(1).Text = "ANATR" Then e.Cancel = True MessageLabel.Text = "You cannot select " + row.Cells(2).Text & "." End If End Sub
DetailsView or FormView「新增」一筆記錄時,.FindControl() 事先帶入預設值?...使用ItemCreated事件
從資料庫中讀取值到 RadioButtonList請問如何從資料庫取值丟給變數
沒有留言:
張貼留言