16,554
社区成员
发帖
与我相关
我的任务
分享
Protected Sub grid_CustomCallback(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs)
If e.Parameters = "Cancel" Then
grid.CancelEdit()
End If
If e.Parameters = "Update" Then
grid.UpdateEdit()
End If
If Session("Dt2").ToString() <> "" Then
If CType(Session("Dt2"), DataTable).Rows.Count > 0 Then
grid.DataSourceID = ""
grid.DataSource = CType(Session("Dt2"), DataTable)
End If
Else
grid.DataBind()
End If
grid.DataBind()
End Sub
Protected Sub grid_RowUpdating(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataUpdatingEventArgs)
Dim EditDt As DataTable = CType(ViewState("Dt1"), DataTable).Clone()
Dim NewDt As DataTable
Dim Dt1 As DataTable
If Session("Dt2").ToString() <> "" Then
If CType(Session("Dt2"), DataTable).Rows.Count > 0 Then
EditDt = CType(Session("Dt2"), DataTable)
End If
End If
If EditDt.Rows.Count > 0 Then
Dt1 = EditDt.Copy()
Else
Dt1 = CType(ViewState("Dt1"), DataTable)
End If
NewDt = Dt1.Clone()
Dim dr() As DataRow
dr = Dt1.Select("1=1")
For i As Integer = 0 To dr.Length - 1
If dr(i)("key_seq") = e.NewValues("key_seq") Then
dr(i)("type") = e.NewValues("type")
dr(i)("ship_to_addr") = e.NewValues("ship_to_addr")
dr(i)("billing_addr") = e.NewValues("billing_addr")
dr(i)("description") = e.NewValues("description")
dr(i)("country") = e.NewValues("country")
dr(i)("vatax_no") = e.NewValues("vatax_no")
dr(i)("ean_code") = e.NewValues("ean_code")
dr(i)("address1") = e.NewValues("address1")
dr(i)("address_txt1") = e.NewValues("address_txt1")
dr(i)("address_txt2") = e.NewValues("address_txt2")
dr(i)("address_txt3") = e.NewValues("address_txt3")
dr(i)("district_txt") = e.NewValues("district_txt")
dr(i)("zip_code") = e.NewValues("zip_code")
dr(i)("city_txt") = e.NewValues("city_txt")
dr(i)("state_txt") = e.NewValues("state_txt")
End If
NewDt.ImportRow(CType(dr(i), DataRow))
Next
Session("Dt2") = NewDt
grid.DataSourceID = ""
grid.DataSource = NewDt
grid.DataBind()
<EditForm>
......
<td style="white-space: nowrap; width: 150px" align="right" colspan="2">
<input type="button" value=" O K " onclick='grid.PerformCallback("Update");' />
<input type="button" value="Cancel" onclick='grid.PerformCallback("Cancel");' />
</td>
.............
</EditForm>