473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

adding edit button to datagrid problem

I had a successfully 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/libr...8(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!
Oct 3 '08 #1
0 820

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andrés Giraldo | last post by:
Hi! I'm adding an asp button to a datagrid on the ItemDataBound event, when the user clicks on this button, I basically remove the button and create other 2 buttons... my problem is.. the 2 last...
2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
5
by: Flare | last post by:
(ASP.NET 1.1) Hi I have a problem with my ViewStates in a userControl. The problem is that the ViewState is not "writte" og changed if you like after editing in my case a textbox. This is...
3
by: Chris Leuty | last post by:
I have a datagrid (with viewstate enabled), and my edit/update/delete buttons in the grid are all working fine. I have a textbox and a button underneath the grid for adding items to the grid. ...
6
by: Bart Schelkens | last post by:
Hi, I have another question. On my asp-page I put a label. I manually create a table and set that table in the text of the label. This way my table is displayed. My question is how can i...
1
by: Mark | last post by:
Hello, I have a need to add a button column to a datagtrid, below is my code and although it does not produce an error, it also does not work, any help? I'm hoping that I can capture the button...
2
by: Tomek R. | last post by:
Hello ! I've got weird problem when adding new datagrid item. Here is the situation: my grid dgDeps is binded to DepartmentList arraylist, stored in Session between round-trips.. To add new...
8
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.