ASPNET - Datagrid

G

Guest

Hi all, i have a problem on a datagrid (webforms),
i don't know if is a problem on my code, if is a bug of DataGrid or simply
if is normal...
When i add a node on a datagrid or when i delete a node, all works fine, but
at this moment if you press F5 to refresh the page, my application continue
to add node(if i added a node) or to delete a node (if i deleted a node).
What's happens?
Thank you all , and scuse me for my bas english.
 
G

Guest

Rodi send me the code part where you fill, add and delete from the grid, so I
can take a look at it.
 
G

Guest

Here the code, is a very simple code....
Private Sub DataGrid_Delete(ByVal source As System.Object, ByVal e
As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
Mydatagrid.DeleteCommand
DeleteNode(e)
End Sub
Private Sub DeleteNode(ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs)
Dim ds As New DataSet
'fill DataSet with xml data
'xmlfile is a reference to a xml file in my server
ds.ReadXml(xmlfile)
ds.Tables(0).Rows(e.Item.DataSetIndex).Delete()
ds.Tables(0).AcceptChanges()
ds.WriteXml(xmlfile)
BindGrid()
End Sub
Private Sub BindGrid()
Dim ds As New DataSet
ds.ReadXml(xmlFileName)
dgMail.DataSource = ds
dgMail.DataBind()
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not (Page.IsPostBack) Then
BindGrid()
End If
End Sub
 
G

Guest

.....Is all here....
DataGrid_Delete calls DeleteNode(e) and DeleteNode() is defined just after
the Fill method id BindGrid which id defined after DeleteNode() ....

Maybe ,viewstate remains in delete mode?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top