Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/08/2010, 11:38
chuchufuentes
 
Fecha de Ingreso: mayo-2008
Mensajes: 353
Antigüedad: 16 años
Puntos: 3
Respuesta: Presiono F5 duplica datos

Ok, listo el pollo aquí la solución para quien la necesite


definir variable
Private IsPageRefresh As [Boolean] = False

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
ViewState("update") = Session("update")
End Sub

load de la pagina
If Not IsPostBack Then
Session("update") = Server.UrlEncode(System.DateTime.Now.ToString())
else
If ViewState("postids").ToString() <> Session("postid").ToString() Then
IsPageRefresh = True
End If
Session("postid") = System.Guid.NewGuid().ToString()
ViewState("postids") = Session("postid")

End If

luego en el boton

Protected Sub btactua_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btactua.Click

If Not IsPageRefresh Then
hago insert o whatever
Else
txtpart.Text = ""
txtdescrparte.Text = ""
FillCustomerGV() proceso para refrescar el GV
End If
end sub

Última edición por chuchufuentes; 03/08/2010 a las 08:43