Postback issues

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Dim index As Integer

index = e.Item.ItemIndex

DsSchedule1.Monday_Schedule.Rows(index).Delete()

OleDbDataAdapter2.Update(DsSchedule1, "Monday_Schedule")

dgMonday.DataBind()



now everytime i run this say in a datagrid with three items everytime time i
refresh after deleting say teh top item all subsequent items get deleted.
How do i stop this?
 
Basically, I run the page.

- I add data to the dataset/database using a textbox
- The problem also happens here as if i press f5 it will keep adding the
same data to the database
- I go to delete (a button column in the datagrid)
- Does delete the record but if I press f5 to refresh it will keep deleting
the records.

Thus because it is having the same kind of problem (just vice-versa) I am
thinking its a postback problem. What I want it to do is when I 'add' an
item if say i do press refresh it won't submit it again and if I press
'delet' it delete the record I choose and thats it.
 
John,

I do not know if it is the isue however because you are so sure of that.

If not Ispostback then
'will means that it is only processed the first time
End if

By the way for this kind of questions you get probably quicker an answer in
the very active newsgroup

microsoft.public.dotnet.framework.aspnet

I hope this helps?

Cor
 
I am getting the same problem and I can't find the solution.
What is happening is that after you delete something from the datagrid
for example and then do browser refresh the DeleteCommand will fire
again and I am clueless why this is happening.
One way to deal with it is to place something like this at the end of
your event:
'Redirect back to this page when done
Response.Redirect(Request.Path)

but do you need to be doing that? probably not, I think it's asp.net
fault
 
Back
Top