当前位置:编程学习 > C#/ASP.NET >>

怎样给数据集中编辑的数据赋默认值?

有如下代码: 
   Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
        DataGrid1.EditItemIndex = e.Item.ItemIndex
        DataGrid1.DataBind()
'要实现在点击“编辑”命令时,给某一列,比如某行第8列要修改的数据赋默认值,在什么位置?怎样实现?
    End Sub
   Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand
        Dim jieguo6, Stop_time8, type3 As String
        Dim key As String = DataGrid1.DataKeys(e.Item.ItemIndex).ToString()
        Dim tb As TextBox
        Dim r As DataRow        

        tb = CType(e.Item.Cells(3).Controls(0), TextBox)
        type3 = tb.Text
        tb = CType(e.Item.Cells(6).Controls(0), TextBox)
        jieguo6 = tb.Text
        tb = CType(e.Item.Cells(8).Controls(0), TextBox)
        Stop_time8 = tb.Text

        r = DataSet_gz1.Tables("gz").Rows.Find(key)
        r("故障类别") = type3
        r("处理结果") = jieguo6
        r("结束时间") = Stop_time8

        SqlDataAdapter1.Update(DataSet_gz1)
        DataGrid1.EditItemIndex = -1
        DataGrid1.DataBind()

    End Sub
'要实现在点击“编辑”命令时,给某一列,比如某行第8列要修改的数据赋默认值,在什么位置?怎样实现?谢谢指点,感激不尽!
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,