riffrack
asked on
ASP.NET 2.0 GridView Delete Row
Hi
I have a gridview, objectdatasource, a class and an XML file containing data. The select and insert statements work fine, but I cannot get the delete statement to work. How do I pass the row number from the gridview to the class?
I have a gridview, objectdatasource, a class and an XML file containing data. The select and insert statements work fine, but I cannot get the delete statement to work. How do I pass the row number from the gridview to the class?
How is your delete statement structured? The row number is unimportant unless it is the key of the row you want to delete.
ASKER
Public Sub DeleteAuthor(ByVal row_id As Integer)
dsAuthors.Tables(0).Rows(r ow_id).Del ete()
dsAuthors.WriteXml(filePat h, Data.XmlWriteMode.WriteSch ema)
End Sub
dsAuthors.Tables(0).Rows(r
dsAuthors.WriteXml(filePat
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi
thanks for this link. I had a look and i still can't quite figure this out.
my gridview is attached to an objectdatasource control, this calls a class in the app_code folder, which stores the business layer. The data is stored in an XML file and the data does not contain a primary key.
any more ideas?
thanks for this link. I had a look and i still can't quite figure this out.
my gridview is attached to an objectdatasource control, this calls a class in the app_code folder, which stores the business layer. The data is stored in an XML file and the data does not contain a primary key.
any more ideas?
Your business layer should then provide a unique key for each record (say, increment an integer from 1 to however many records you have in your XML file, then pass that integer as an additional column of the records you supply to the ObjectDataSource when a Select request is made of it. It is the capable to do things like this that must have made you decide to use ObjectDataSource instead of XMLDataSource in the first place (I assume).
Do you understand what I'm saying?:
Do you understand what I'm saying?: