I had a successfullyy deployed datagrid reading an XML file and
showing the data:
Private Function MakeDataView() as DataView
Dim myDataSet As New DataSet()
myDataSet.ReadXml(Server.MapPath("TimberSales.xml"))
Dim view As DataView = New DataView(myDataSet.Tables(0))
view.AllowDelete = False
view.AllowEdit = True
view.AllowNew = False
view.Sort = "Year ASC"
Return view
End Function
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim view as DataView = MakeDataView()
dgTimber.DataSource = view
dgTimber.AllowSorting = True
dgTimber.DataBind()
End Sub
______________________________________________________________________
I wanted to add an "Edit" button as desribed at:
http://msdn.microsoft.com/en-us/library/aa984288(VS.71).aspx:
Private Sub dgTimber_EditCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
Handles dgTimber.EditCommand
dgTimber.EditItemIndex = e.Item.ItemIndex
dgTimber.DataBind()
End Sub
Dim newData As String
Dim aTextBox As TextBox
aTextBox = CType(e.Item.Cells(1).Controls(0), TextBox)
**** says "aTextBox" is not declared, (?)
newData =
aTextBox.Text **** says
"newData" is not declared, (?)
Private Sub dgTimber_UpdateCommand(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
Handles dgTimber.UpdateCommand
Dim quantityCell As TableCell = e.Item.Cells(6)
Dim quantityBox As TextBox = _
CType(quantityCell.Controls(0), TextBox)
Dim quantity As Integer = System.Int32.Parse(quantityBox.Text)
dgTimber.EditItemIndex = -1
dgTimber.DataBind()
End Sub
When I hit the Edit Button I get this:
Invalid postback or callback argument. Event validation is enabled
using <pages enableEventValidation="true"/>
in configuration or <%@ Page EnableEventValidation="true" %> in a
page. For security purposes, this feature ....etc.
Does anything obvious stabd out as the potential probelm? Thank You!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
<p><a href="http://feeds.feedburner.com/DotNetDevelopment"><img
src="http://feeds.feedburner.com/~fc/DotNetDevelopment?bg=99CCFF&fg=444444&anim=1"
height="26" width="88" style="border:0" alt="" /></a></p>
-~----------~----~----~----~------~----~------~--~---