我在包含两个文本框和一个链接按钮控件的网格视图中放置了一个 EmptyTemplate控件。单击链接按钮控件后,输入到文本框中的数据将被复制到 xml 文件中。
脚本-重新发布
Public Sub writeStartpoNum(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim startpoNumID As String = DirectCast(gvPurchaseOrderNum.Controls(0).Controls(0).FindControl("txtStartpoNumID"), TextBox).Text
Dim startpoNum As String = DirectCast(gvPurchaseOrderNum.Controls(0).Controls(0).FindControl("txtStartpoNum"), TextBox).Text
Dim oDs As New DataSet()
oDs.ReadXml(Server.MapPath("~/xml/newshipmentnotification.xml"))
oDs.Tables.Clear()
oDs.DataSetName = "newshipmentnotification"
oDs.Tables.Add("pos")
oDs.Tables("pos").Columns.Add("pos_Id")
oDs.Tables("pos").Columns("pos_Id").ColumnMapping = MappingType.Hidden
oDs.Tables.Add("po")
oDs.Tables("po").Columns.Add("ponumberID")
oDs.Tables("po").Columns.Add("pos_Id")
oDs.Tables("po").Columns("pos_Id").ColumnMapping = MappingType.Hidden
oDs.Tables("po").Columns.Add("ponumber")
Dim pos_po As DataRelation = oDs.Relations.Add("pos_po", oDs.Tables("pos").Columns("pos_Id"), _
oDs.Tables("po").Columns("pos_Id"))
pos_po.Nested = True
Dim oDrs As DataRow = oDs.Tables("pos").NewRow
oDrs("pos_Id") = 0
oDs.Tables("pos").Rows.Add(oDrs)
Dim oDr As DataRow = oDs.Tables("po").NewRow
oDr("ponumberID") = startpoNumID
oDr("ponumber") = startpoNum
oDr("pos_Id") = 0
oDs.Tables("po").Rows.Add(oDr)
oDs.WriteXml(Server.MapPath("~/xml/newshipmentnotification.xml"))
End Sub