473,386 Members | 1,654 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,386 software developers and data experts.

INFO-BUG: GridView Double-Post Problem


This is information for those who may have been bitten by the
"double-post" problem in GridView controls. I've been messing with
ASP.Net about a week, and have uncovered an annoying 'feature'.
Never bothered with Net 1.x, and have stuck with cASP so far...

Summary:
--------------------
When the Command Field consists of a button or text, the control
behaves properly. When an image is used, it does not.
After studying the HTML generated and sent to the client, I have
determined the following:

When TEXT is used, the __doPostBack javascript code is attached.
When BUTTON is used, it does not attach the __do PostBack code.
Instead, it uses the browser's intrinsic behavior to post.

The Bug
-----------------
Now this is where the beast rears it's ugly head...
When IMAGE is used, ASP.Net attaches the __do PostBack code to the
image's OnClick() event, but the image is also defined as an <INPUT>.
So, the browser engine generates a postback as well. This leads to a
double postback to the server.

Workaround
----------------------
A temporary solution is to manually create a Template Field to
encapsulate the image(s), rather then the built in Command Field.
ASP.Net does NOT attach the __doPostBack code to the image's onClick
event when in a Template Field.

Solution
---------------
The proper solution is to alter this behavior in ASP.Net.

And while you're at it, how about the <TABLE> idiosyncrasies of IE?
( cellpadding and cellspacing ) Rather than defining a CSS style for
these, you have to format inline in the page markup. It's been 10
years now... How about it, Bill? ;-)

FWIW,
Greg G.
Mar 15 '06 #1
1 1719
GregG said:
( cellpadding and cellspacing ) Rather than defining a CSS style for
these, you have to format inline in the page markup.


OK - I'm an idiot. I forgot that you have to define the <td> or <th>
properties in CSS for tables... :-) It's been a loooong week.
i.e.:

td, th
{
margin: 0;
padding: 0;
}

FWIW,

Greg G.
Mar 15 '06 #2

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

Similar topics

7
by: ivan_oj28 | last post by:
Hi, I am developing an application where I need to read the caller id from an incoming call. The only info (for now) I need is the caller id info, so that I can display the propper caller info on...
1
by: Tertius Cronje | last post by:
Hi All, Q: Is it possible for a thread on SocketServer.ThreadingTCPServer to get the socket info of *other* open thread/s and use that info to send data to the accepting client? I wrote a...
1
by: Kenshin | last post by:
Hey! I have another script where i pull all the information from the database and I want to send it to the person. What they do is they enter in their email, and if the email matches, than it will...
4
by: Chris | last post by:
I'm wondering what is the "best" way to structure a set of info about an item, like a book or a hotel. Eg, let's say you had this info to present for each book in a collection: Title Author...
2
by: jeff_zhang446 | last post by:
Hi, I try to write some data structure into a file as below and would appreciate if someone can give me some advice here. row(1) 100 1 0 0 0 0 0 0 0 1 row(2) 150 5 0 0 0 0 0...
4
by: Alberto | last post by:
Could you tell me what it's for the "Persist Security Info ..." value in a connection string. Thank you.
0
by: Daniel | last post by:
C# windows service freezes on System.Diagnostics.Process.Start(info) When I launch PSCP from a C# windows service and launch pscp 0.53 there are no issues. but when I use C# windows service to...
0
by: jokerman | last post by:
I want to grab the amount of images in each <subnumber> section. How? I have this code in Flash; var pArray = new Array(); var tArray = new Array(); var myXML:XML = new XML();...
1
by: oddbande | last post by:
We have just upgraded a test enviroment to db2 9, and have set both the notifylevel and diaglevel to 3. But even so I get a lot of these messages in my db2diag.log: ...
4
by: John | last post by:
I have several buttons that show their button info when you move over them with your mouse. I addes 3 new buttons and added button info but for them the info doesn't show up. The settings seems to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.