469,575 Members | 1,631 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

ASPNET - Datagrid

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.
Dec 1 '05 #1
3 987
Rodi send me the code part where you fill, add and delete from the grid, so I
can take a look at it.

--
adasilva
"Rodi Roberto" wrote:
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.

Dec 1 '05 #2
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
"adasilva" wrote:
Rodi send me the code part where you fill, add and delete from the grid, so I
can take a look at it.

--
adasilva
"Rodi Roberto" wrote:
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.

Dec 2 '05 #3
.....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?
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
"adasilva" wrote:
Rodi send me the code part where you fill, add and delete from the grid, so I
can take a look at it.

--
adasilva

Dec 7 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Anatoly | last post: by
3 posts views Thread by Harry Simpson | last post: by
2 posts views Thread by daviddabwang | last post: by
4 posts views Thread by trouling | last post: by
5 posts views Thread by Harlan Messinger | last post: by
reply views Thread by =?Utf-8?B?SmVmZnJleQ==?= | last post: by
2 posts views Thread by =?Utf-8?B?SmVmZnJleQ==?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.