473,419 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Unwanted data injected into datagrid textbox

Hello, and thank you in advance for any help you can provide.

Each line in our datagrid control contains a product number,
description, and a textbox for the user to enter a quantity-to-order.

Users enter quantities (not necessarily on every line), click the Next
button, and continue. Sometimes users return to a previous page, by
clicking the Previous button, and see quantities that they did not
enter. More often, users return to a previous page to find unwanted
quantities added and wanted quantities deleted.

A dozen customers have reported this problem over the last six months,
but we have been unable to reproduce it in-house. It is extremely
rare, but one week it happened four times.

Has anyone else experienced anything like this? Our solution was
developed by a third party, but I am becoming more familiar with the
source code. I can answer any questions to clarify the issue.
Patterns we have identified
==============================
1. There has never been an equal number of items deleted and inserted.
2. The deleted items are always contiguous to one another. (Items are
organized by a fixed catalog line number.)
3. The inserted items are always contiguous to one another.
Notes
======
1. The solution uses custom paging (datagrid.allowpaging=FALSE).
2. This behavior occurs before any records are written to the SQL
Server backend. (That happens when the user clicks the Save button or
the Place Order button.)
3. Solution was developed in Microsoft Visual Studio .NET 2003.
4. Our in-house Windows PCs are all at Framework level 1.1.4322.2032
(Service Pack 1); the server is also at SP1 level (1.1.4322.2300); am
waiting to hear back from two customers what version of the .NET
Framework they're using.
5. All clients are using Internet Explorer 6.0.

Nov 13 '06 #1
3 1689
your code does not handle duplicate postbacks. go to you UI, add a unit, hit
you update button. then refersh the page after the update (should get a
repost message from browser). you will see the problem.

common fixes.

1) store a transaction id with evey postback to detect its been done
2) for carts, have user select quanity rather then add/delete.

you need to do #1 for cc charging our you will double bill.

-- bruce (sqlwork.com)
"kingflux" <ti*@eNardoni.comwrote in message
news:11*********************@f16g2000cwb.googlegro ups.com...
Hello, and thank you in advance for any help you can provide.

Each line in our datagrid control contains a product number,
description, and a textbox for the user to enter a quantity-to-order.

Users enter quantities (not necessarily on every line), click the Next
button, and continue. Sometimes users return to a previous page, by
clicking the Previous button, and see quantities that they did not
enter. More often, users return to a previous page to find unwanted
quantities added and wanted quantities deleted.

A dozen customers have reported this problem over the last six months,
but we have been unable to reproduce it in-house. It is extremely
rare, but one week it happened four times.

Has anyone else experienced anything like this? Our solution was
developed by a third party, but I am becoming more familiar with the
source code. I can answer any questions to clarify the issue.
Patterns we have identified
==============================
1. There has never been an equal number of items deleted and inserted.
2. The deleted items are always contiguous to one another. (Items are
organized by a fixed catalog line number.)
3. The inserted items are always contiguous to one another.
Notes
======
1. The solution uses custom paging (datagrid.allowpaging=FALSE).
2. This behavior occurs before any records are written to the SQL
Server backend. (That happens when the user clicks the Save button or
the Place Order button.)
3. Solution was developed in Microsoft Visual Studio .NET 2003.
4. Our in-house Windows PCs are all at Framework level 1.1.4322.2032
(Service Pack 1); the server is also at SP1 level (1.1.4322.2300); am
waiting to hear back from two customers what version of the .NET
Framework they're using.
5. All clients are using Internet Explorer 6.0.

Nov 13 '06 #2
Thank you for writing, Bruce. Duplicate postback is a real
possibility, though if it is, I don't think the users are doing it
intentionally.

Example: When I refreshed the page, as you suggested, a dialog box
appeared: "The page cannot be refreshed without resending the
information." Clicking Retry does "delete" the items; clicking Cancel
causes "Warning: Page has expired." No users have reported such
behavior at any time.

HOWEVER, some users who have reported this rare deletion/insertion have
reported that the grid appeared to jump two pages when they click the
Next button once. Could this be the same thing? I have tried to get
the grid to skip a page with all manner of double-clicking and other
antics, but have never made it happen.

Is it possible that something is happening internally on the grid or
the page that might cause or mimc this rare duplicate postback
behavior? (Almost like a mouse click that Windows interprets as a
delayed double click; I have seen this many times.)
Regarding your suggestions, forgive me: being primarily a sysadmin who
occasionally dabbles in scripting and MS Access VBA, I am not familiar
with the implementation of a transaction id for something at this
level.

- Is there a "transaction id" within the postback process that I can
utilize?
- If not, how would you generate it?
- How would I determine if the postback was successful?

(We are using all custom code; no carts are being used as far as I can
tell.)
Meanwhile, I'm tediously plowing through a couple of articles that I
found when I googled for 'duplicate postback' and trying to figure out
if our current code *is* trying to prevent that:

Preventing Duplicate Record Insertion or Page Refresh on postback of a
Web Form
http://aspalliance.com/687

Preventing Duplicate Record Insertion on Page Refresh
http://www.codeproject.com/aspnet/formKeyManager.asp
-Tim

Nov 14 '06 #3
I am thrilled to announce that we figured out what is happening with
the 'unwanted data injected into datagrid textbox' (posted Nov 13 2006)
and it is now fixed on our site.

I found the cause purely by accident, when testing on an older server
that is significantly slower than our production web server. I found
that I could click the Next button multiple times while I waited 5-8
seconds between page loads. Whenever I did, it "jumped" the same
number of pages and copied the values from the first page to all the
subsequent pages that were "touched" in the transaction. Nothing on
the screen would ever suggest to the user that such a thing had
occurred.

Mr. Barker from sqlwork.com was definitely on the right track when he
suggested duplicate postback was the likely problem -- so THANK YOU,
sir, very much!

At the bottom of the page, just before the closing HTML tag, we added
this javascript code, which disables all buttons on the page and
displays a "Processing..." message until the next page loads:
<script language="javascript">
/* Code to fix multi-click issue */

// handle the unload of the form
window.attachEvent("onbeforeunload", disableWindowControlsOnUnload);

// loop through relevant input controls and make sure the users do
attempt a postback
var elementCollection = document.getElementsByTagName("input");
if ( elementCollection != null )
{
for ( var i = 0; i < elementCollection.length; i++ )
{
var element = elementCollection(i);
if ( element.type == "submit" || element.type == "button" )
{
element.attachEvent("onclick", disableWindowControlsOnClick);
element.attachEvent("ondblclick", handleDoubleClick);
}
}
}

// this method used to disable any input controls from firing
function disableWindowControlsOnUnload()
{
document.body.style.cursor = "wait";
for ( var j = 0; j < document.forms.length; j++ )
{
var elementCollection =
document.forms(j).getElementsByTagName("input");
for ( var i = 0; i < elementCollection.length; i++ )
{
var element = elementCollection(i);
if ( thisElement.type == "submit" || thisElement.type == "button" )
element.disabled = true;
}
}

return true;
}

// this will make sure no events create a double post scenario
var bubbleEvent = true;
function disableWindowControlsOnClick()
{
if ( bubbleEvent == true )
{
document.body.style.cursor = "wait";
showProcessingBanner();
bubbleEvent = false;
}
else
{
window.event.cancelBubble = false;
window.event.returnValue = false;
}
}

function handleDoubleClick()
{
window.event.cancelBubble = false;
window.event.returnValue = false;
}
function showProcessingBanner()
{
var bannerElement = "<div style='position:absolute; z-index:99;
border-style:solid; background-color:white; width:400px;
height:200px;'></div>";
var banner = document.createElement(bannerElement);

banner.innerHTML = "<span style='color:black; font-size:large;
vertical-align:middle;'><center><br><br><br>Processing...</center></span>";
banner.style.left = ( window.screen.availWidth / 2 ) - 200;
banner.style.top = ( window.screen.availHeight / 2 ) - 100;
document.body.insertBefore(banner);
}

</script>
kingflux wrote:
Thank you for writing, Bruce. Duplicate postback is a real
possibility, though if it is, I don't think the users are doing it
intentionally.

Example: When I refreshed the page, as you suggested, a dialog box
appeared: "The page cannot be refreshed without resending the
information." Clicking Retry does "delete" the items; clicking Cancel
causes "Warning: Page has expired." No users have reported such
behavior at any time.

HOWEVER, some users who have reported this rare deletion/insertion have
reported that the grid appeared to jump two pages when they click the
Next button once. Could this be the same thing? I have tried to get
the grid to skip a page with all manner of double-clicking and other
antics, but have never made it happen.

Is it possible that something is happening internally on the grid or
the page that might cause or mimc this rare duplicate postback
behavior? (Almost like a mouse click that Windows interprets as a
delayed double click; I have seen this many times.)
Regarding your suggestions, forgive me: being primarily a sysadmin who
occasionally dabbles in scripting and MS Access VBA, I am not familiar
with the implementation of a transaction id for something at this
level.

- Is there a "transaction id" within the postback process that I can
utilize?
- If not, how would you generate it?
- How would I determine if the postback was successful?

(We are using all custom code; no carts are being used as far as I can
tell.)
Meanwhile, I'm tediously plowing through a couple of articles that I
found when I googled for 'duplicate postback' and trying to figure out
if our current code *is* trying to prevent that:

Preventing Duplicate Record Insertion or Page Refresh on postback of a
Web Form
http://aspalliance.com/687

Preventing Duplicate Record Insertion on Page Refresh
http://www.codeproject.com/aspnet/formKeyManager.asp
-Tim
Dec 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
1
by: sandman | last post by:
I've got a simple windows form with some bound textboxes and Save button. Each texbox is bound to column in a table in an Access database. The form fills fine - all the fields show the correct...
0
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format....
2
by: Joe Au | last post by:
I follow the Walkthrough documented on Visual Studio to create an editable data grid but it does not work on getting the value of the textbox in the data grid. The code is copied here. I mark...
2
by: naija naija | last post by:
Hello guys i made a Datagrid with Editing,Update and Cancel using VS.NET. to my surprise nothing is on the screen after compilation .. By code below:- Imports System.Data Imports...
3
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of...
0
by: Eric Sabine | last post by:
OK, I'm trying to further my understanding of threading. The code below I wrote as kind of a primer to myself and maybe a template that I could use in the future. What I tried to do was pass data...
0
by: ashwin | last post by:
I have a Data Grid to display employee names and codes. On clicking a button (outside the datagrid) I perform some calculations which sets the fields of other columns in the datagrid. The problem...
0
by: ashwin | last post by:
I have a Data Grid to display employee names and codes. On clicking a button (outside the datagrid) I perform some calculations which sets the fields of other columns in the datagrid. The problem...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.