Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2009, 06:25 PM
Authorized User
 
Join Date: Feb 2009
Posts: 10
Thanks: 1
Thanked 2 Times in 2 Posts
Default Double Inserting in Listview after Refresh by user

Hi,

when my users refresh a page after inserting a record in a ListView, that record is inserted again.
Though probably this won't occur, because a user has no reason to refresh the page, the same thing happens when the last action by the user was inserting and the login time is over. The user gets the login form, gets back to the ListView page where the last inserted record appears to be inserted twice.
Is there a way to avoid this behaviour?

Best regards

Hans
 
Old June 8th, 2009, 08:19 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Have you tried resetting the form after the postback?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old June 9th, 2009, 09:58 AM
Authorized User
 
Join Date: Feb 2009
Posts: 10
Thanks: 1
Thanked 2 Times in 2 Posts
Default

Hi Lee,

I could use Response.Redirect, but I was hoping for a more subtle solution.
What do you mean by resetting? Is that making all TextBoxes empty?

Changing the behaviour of the Login control would be a solution too. Right now the user returns to the page last visited (in this case the page with the ListView), after a re-login. I expected that my Login Control would direct the user to the Default page, but that's not the case. Is there a way to always redirect to the Default page?

Code:
<asp:Login ID="Login1" runat="server" 
  FailureText="Inloggen is mislukt. Probeer nogmaals." 
    DestinationPageUrl="~/Default.aspx" TitleText="Inloggen" DisplayRememberMe="False">
  <FailureTextStyle Font-Bold="True" />
</asp:Login>
thanks,

Hans

Last edited by hans; June 9th, 2009 at 10:34 AM..
 
Old June 9th, 2009, 11:02 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

The DestinationPageUrl property specifies the page that is displayed when a login attempt is successful.

The default behavior of the Login control is to return the user to the referring page, or to the page defined in the defaultUrl attribute of the forms element in the Web.config file.

The DestinationPageUrl property overrides the default behavior of the Login control, as well as the defaultUrl setting made in the configuration file. So yes, specifying the DestinationPageUrl should prevent the user from returning to the same page.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh Listview after Database Update neo_jakey Pro VB 6 8 March 14th, 2011 04:33 AM
Auto-refresh user control in .NET 1.1 r_adarsh .NET Framework 1.x 2 February 1st, 2008 05:51 AM
Expanding TreeView from double clicking ListView maxl Pro Visual Basic 2005 1 March 5th, 2007 12:54 PM
Get user control to refresh apd8x ASP.NET 1.0 and 1.1 Basics 8 November 10th, 2003 04:21 PM
Inserting "Double Quotes" ASP?VBScript/SQL Server craigcsb Classic ASP Databases 1 July 4th, 2003 10:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.