473,729 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help please on GridView commands + AutoEventWireUp , firing twice etc...

hi,
i'm new to .net 2.0, and am just starting to get to grips with the
gridview.
my page has autoEventWireUp set to true, which i gather is supposed to
figure out which handlers to invoke when appropriate based on your
method names .
the GridView has OnRowCommand="G ridView1_RowCom mand" in the aspx.

my problem is that the RowCommand event is firing twice (95% of the
time) on the page. the other 5% it only fires once. there's no
consistency at all.

in .net 1.1, i would have understood that the code-behind was wiring up
the event, and the aspx was doing the same thing, so this would result
in the event being raised twice. however, in .net 2, i can't find any
code-behind that would be doing this (even looked in temp.asp.net
files).

if i set autoEventWireUp =true, with the OnRowCommand declared in the
GridView aspx, Page_Load fires twice, so does GridView1_RowCo mmand.

if i set AutoEventWireup =false, PageLoad doesn't fire (as is expected)
and GridView1_RowCo mmand only fires once. but occassionally it fires
twice. this is painful! somebody please put me out of my misery :-)

here is my code:
******** ASPX *********
<%@ Page Language="C#" AutoEventWireup ="false"
CodeFile="TestG ridView.aspx.cs " Inherits="Admin _TestGridView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataKeyNames="P ageID"
DataSourceID="d sPages"
OnRowCommand="G ridView1_RowCom mand">
<Columns>
<asp:BoundFie ld DataField="Titl eForEdit"
HeaderText="Tit le" />
<asp:ButtonFiel d ButtonType="Ima ge"
CommandName="Mo veUp" ImageUrl="../Images/Move_Up.gif"
Text="Move this page up one position" />
<asp:ButtonFiel d ButtonType="Ima ge"
CommandName="Mo veDown" ImageUrl="../Images/Move_Down.gif"
Text="Move this page down one position" />
</Columns>
</asp:GridView>
<asp:ObjectData Source ID="dsPages" runat="server"
SelectMethod="S elect" TypeName="PageM anager">
</asp:ObjectDataS ource>
</form>
</body>
</html>
********** CODE BEHIND ***********
public partial class Admin_TestGridV iew : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
Response.Write( "Page_Load<HR>" );
}

protected void GridView1_RowCo mmand(object sender,
GridViewCommand EventArgs e)
{
Response.Write( "GridView1_RowC ommand<HR>");
}
}

what i did was put break-points in both events, debug, and keep
clicking the up/down buttons until you see the event hit twice for one
click.

thank you
tim

Dec 16 '05 #1
28 10271
Hi tim,

You do not need to specify the OnRowCommand if you have the autoEventWireUp
=true.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Tim_Mac" wrote:
hi,
i'm new to .net 2.0, and am just starting to get to grips with the
gridview.
my page has autoEventWireUp set to true, which i gather is supposed to
figure out which handlers to invoke when appropriate based on your
method names .
the GridView has OnRowCommand="G ridView1_RowCom mand" in the aspx.

my problem is that the RowCommand event is firing twice (95% of the
time) on the page. the other 5% it only fires once. there's no
consistency at all.

in .net 1.1, i would have understood that the code-behind was wiring up
the event, and the aspx was doing the same thing, so this would result
in the event being raised twice. however, in .net 2, i can't find any
code-behind that would be doing this (even looked in temp.asp.net
files).

if i set autoEventWireUp =true, with the OnRowCommand declared in the
GridView aspx, Page_Load fires twice, so does GridView1_RowCo mmand.

if i set AutoEventWireup =false, PageLoad doesn't fire (as is expected)
and GridView1_RowCo mmand only fires once. but occassionally it fires
twice. this is painful! somebody please put me out of my misery :-)

here is my code:
******** ASPX *********
<%@ Page Language="C#" AutoEventWireup ="false"
CodeFile="TestG ridView.aspx.cs " Inherits="Admin _TestGridView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataKeyNames="P ageID"
DataSourceID="d sPages"
OnRowCommand="G ridView1_RowCom mand">
<Columns>
<asp:BoundFie ld DataField="Titl eForEdit"
HeaderText="Tit le" />
<asp:ButtonFiel d ButtonType="Ima ge"
CommandName="Mo veUp" ImageUrl="../Images/Move_Up.gif"
Text="Move this page up one position" />
<asp:ButtonFiel d ButtonType="Ima ge"
CommandName="Mo veDown" ImageUrl="../Images/Move_Down.gif"
Text="Move this page down one position" />
</Columns>
</asp:GridView>
<asp:ObjectData Source ID="dsPages" runat="server"
SelectMethod="S elect" TypeName="PageM anager">
</asp:ObjectDataS ource>
</form>
</body>
</html>
********** CODE BEHIND ***********
public partial class Admin_TestGridV iew : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
Response.Write( "Page_Load<HR>" );
}

protected void GridView1_RowCo mmand(object sender,
GridViewCommand EventArgs e)
{
Response.Write( "GridView1_RowC ommand<HR>");
}
}

what i did was put break-points in both events, debug, and keep
clicking the up/down buttons until you see the event hit twice for one
click.

thank you
tim

Dec 16 '05 #2
hi Philip, thanks for the reply.
ok so that is what's supposed to happen, i would agree with you.
except... when i set autoEventWireUp =true, the GridView1_RowCo mmand
event is not raised at all when i click one of the button fields, and
Page_Load fires twice when i click the button. it only fires once when
the page is first loaded.

the code i'm using is the exact same as posted above, except
OnRowCommand has been removed from the gridView aspx, and
autoEventWireUp has been changed to true.

why would Page_Load fire twice, and why does autoEventWireUp not do
it's job in hooking up my RowCommand event handler?

thanks
tim

Dec 18 '05 #3
Hi Tim,

Thanks for responding. This discussion got me to correct some of my
misconceptions about the AutoEventWireUp property.

Here is what I found by researching the topic:
1- The AutoEventWireUp applies only to the page events. For an explanation
of the page events:
http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
2- You have to wire up the events for the controls within the page even if
you have the AutoEventWireUp =true. The VS.Net does that automatically when
you double click on a control by adding markup for you within the server
control.

To verify my findings, I created 3 demos out of the code that you posted
earlier:
1- In this demo the AutoEventWireUp is set to true and the event fire up
twice because I have also overridden the OnInit method and put event wiring
for controls in it
http://www.webswapp.com/CodeSamples/...rue_Error.aspx

2- In this demo the AutoEventWireUp is set to true and everything works as
expected
http://www.webswapp.com/CodeSamples/...reUp_True.aspx

3- In this demo the AutoEventWireUp is set to false (my preference in
programming because it improves performance) and everything works as expected
http://www.webswapp.com/CodeSamples/...eUp_False.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Tim_Mac" wrote:
hi Philip, thanks for the reply.
ok so that is what's supposed to happen, i would agree with you.
except... when i set autoEventWireUp =true, the GridView1_RowCo mmand
event is not raised at all when i click one of the button fields, and
Page_Load fires twice when i click the button. it only fires once when
the page is first loaded.

the code i'm using is the exact same as posted above, except
OnRowCommand has been removed from the gridView aspx, and
autoEventWireUp has been changed to true.

why would Page_Load fire twice, and why does autoEventWireUp not do
it's job in hooking up my RowCommand event handler?

thanks
tim

Dec 19 '05 #4
Hi Tim,

As for ASP.NET 2.0's new page compilation model, the AutoWireupEvent is no
longer turn off by default in VS2005 web project IDE. And the page's
AutoEventWireup should only apply to page's events rather than any other
server controls' events. So if we have the page's AutoEventWireup set to
"false" and we don't explicitly register Page_load function for page, and
also dosn't add GridView's RowCommand event handler in the aspx template,
neither event handler should be fired.....

so for your scenario, I think it should be an page specific or environment
specific problem. Here is test page I used on myside which works as
expected:(I also use the page's OutputTrace to print the event handler
exection time.....)

#when AutoWireupEvent turn off, Page_Load not executed , but RowCommand
still work since it is delcared through aspx template's control attribute

#when AutoWireupEvent turn on, both event handler get executed and only
once.....

You can have a test through it to see whether it also encounter the problem:

=========aspx== ========
<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Event WireupPage.aspx .cs" Inherits="Event WireupPage" Trace="true"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:LocalNorthWi nd %>"
SelectCommand=" SELECT [CategoryID], [CategoryName],
[Description] FROM [Categories]">
</asp:SqlDataSour ce>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataKeyNames="C ategoryID"
DataSourceID="S qlDataSource1"
OnRowCommand="G ridView1_RowCom mand">
<Columns>
<asp:BoundFie ld DataField="Cate goryID"
HeaderText="Cat egoryID" InsertVisible=" False"
ReadOnly="True" SortExpression= "CategoryID " />
<asp:BoundFie ld DataField="Cate goryName"
HeaderText="Cat egoryName" SortExpression= "CategoryNa me" />
<asp:BoundFie ld DataField="Desc ription"
HeaderText="Des cription" SortExpression= "Descriptio n" />
<asp:ButtonFiel d CommandName="Mo veUp" Text="MoveUp" />
<asp:ButtonFiel d CommandName="Mo veDown" Text="MoveDown" />
</Columns>
</asp:GridView>

</div>
</form>
</body>
</html>

==========code behind========= =
public partial class EventWireupPage : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
Trace.Write("Pa ge_load " + DateTime.Now.To LongTimeString( ) );
}
protected void GridView1_RowCo mmand(object sender,
GridViewCommand EventArgs e)
{
Trace.Write("Ro wCommand " + e.CommandName + " " +
DateTime.Now.To LongTimeString( ));
}
}
=============== =====

Please feel free to post here when you have any furhter finding or need any
assistance.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: help please on GridView commands + AutoEventWireUp , firing
twi
| thread-index: AcYEVW+3hSkc5a7 PT+ar2/nTIb7cww==
| X-WBNR-Posting-Host: 70.68.38.48
| From: "=?Utf-8?B?UGhpbGxpcCB XaWxsaWFtcw==?= "
<Ph************ **@webswapp.com >
| References: <11************ **********@z14g 2000cwz.googleg roups.com>
<B6************ *************** *******@microso ft.com>
<11************ **********@g44g 2000cwa.googleg roups.com>
| Subject: Re: help please on GridView commands + AutoEventWireUp , firing
twi
| Date: Sun, 18 Dec 2005 20:34:02 -0800
| Lines: 56
| Message-ID: <D9************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGXA03.phx .gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3656 26
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Hi Tim,
|
| Thanks for responding. This discussion got me to correct some of my
| misconceptions about the AutoEventWireUp property.
|
| Here is what I found by researching the topic:
| 1- The AutoEventWireUp applies only to the page events. For an
explanation
| of the page events:
| http://msdn2.microsoft.com/en-us/lib...US,VS.80).aspx
| 2- You have to wire up the events for the controls within the page even
if
| you have the AutoEventWireUp =true. The VS.Net does that automatically
when
| you double click on a control by adding markup for you within the server
| control.
|
| To verify my findings, I created 3 demos out of the code that you posted
| earlier:
| 1- In this demo the AutoEventWireUp is set to true and the event fire up
| twice because I have also overridden the OnInit method and put event
wiring
| for controls in it
|
http://www.webswapp.com/CodeSamples/...rue_Error.aspx
|
| 2- In this demo the AutoEventWireUp is set to true and everything works
as
| expected
| http://www.webswapp.com/CodeSamples/...reUp_True.aspx
|
| 3- In this demo the AutoEventWireUp is set to false (my preference in
| programming because it improves performance) and everything works as
expected
| http://www.webswapp.com/CodeSamples/...eUp_False.aspx
|
| --
| HTH,
| Phillip Williams
| http://www.societopia.net
| http://www.webswapp.com
|
|
| "Tim_Mac" wrote:
|
| > hi Philip, thanks for the reply.
| > ok so that is what's supposed to happen, i would agree with you.
| > except... when i set autoEventWireUp =true, the GridView1_RowCo mmand
| > event is not raised at all when i click one of the button fields, and
| > Page_Load fires twice when i click the button. it only fires once when
| > the page is first loaded.
| >
| > the code i'm using is the exact same as posted above, except
| > OnRowCommand has been removed from the gridView aspx, and
| > autoEventWireUp has been changed to true.
| >
| > why would Page_Load fire twice, and why does autoEventWireUp not do
| > it's job in hooking up my RowCommand event handler?
| >
| > thanks
| > tim
| >
| >
|

Dec 19 '05 #5
philip, many thanks for the examples.
steven, thanks also for the reply. i have narrowed down my problem,
and i am quite sure at this stage that i have encountered a bizarre
behaviour/bug/feature/whatever.

if you take your sample page that you made, and add the following
attributes to the 2 button fields:
ButtonType="ima ge" ImageUrl="MoveU p.gif"

if you debug your code then, you will see Page_Load gets invoked twice,
and so does RowCommand. that's the only change i made, and when i go
back to your original version with the text/button columns, it works
fine. this is an empty web project with one aspx page so there are no
unusual config problems.

it is very frustrating!! i hope you can shed some light on this
behaviour.
thanks
tim

Dec 19 '05 #6
Hey Tim,

Thanks for your quick response.
I've just made some further test according to the change you mentioened,
below is my modiied page's aspx template:

However, I still only get the Page_Load or GridView_OnRowC ommand fire
once.... Would you please attache a complete project that contains such a
reproduce page in it so that I can test through the complete project on
myside?
========aspx=== =======
<%@ Page Language="C#" AutoEventWireup ="true"
CodeFile="Event WireupPage.aspx .cs" Inherits="Event WireupPage" Trace="false"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:LocalNorthWi nd %>"
SelectCommand=" SELECT [CategoryID], [CategoryName],
[Description] FROM [Categories]">
</asp:SqlDataSour ce>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataKeyNames="C ategoryID"
DataSourceID="S qlDataSource1"
OnRowCommand="G ridView1_RowCom mand">
<Columns>
<asp:BoundFie ld DataField="Cate goryID"
HeaderText="Cat egoryID" InsertVisible=" False"
ReadOnly="True" SortExpression= "CategoryID " />
<asp:BoundFie ld DataField="Cate goryName"
HeaderText="Cat egoryName" SortExpression= "CategoryNa me" />
<asp:BoundFie ld DataField="Desc ription"
HeaderText="Des cription" SortExpression= "Descriptio n" />
<asp:ButtonFiel d CommandName="Mo veUp" ButtonType=imag e
ImageUrl="~/Images/menu_pop_dynami c.GIF" Text="MoveUp" />
<asp:ButtonFiel d CommandName="Mo veDown" ButtonType=imag e
ImageUrl="~/Images/menu_pop_static .GIF" Text="MoveDown" />
</Columns>
</asp:GridView>

</div>
</form>
</body>
</html>
=============== =============== ======

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Tim_Mac" <ti*@mackey.i e>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Subject: Re: help please on GridView commands + AutoEventWireUp , firing
twi
| Date: 19 Dec 2005 03:56:12 -0800
| Organization: http://groups.google.com
| Lines: 20
| Message-ID: <11************ **********@f14g 2000cwb.googleg roups.com>
| References: <11************ **********@z14g 2000cwz.googleg roups.com>
| <B6************ *************** *******@microso ft.com>
| <11************ **********@g44g 2000cwa.googleg roups.com>
| <D9************ *************** *******@microso ft.com>
| <Zp************ **@TK2MSFTNGXA0 2.phx.gbl>
| NNTP-Posting-Host: 83.141.121.205
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google. com 1134993378 19451 127.0.0.1 (19 Dec 2005
11:56:18 GMT)
| X-Complaints-To: gr**********@go ogle.com
| NNTP-Posting-Date: Mon, 19 Dec 2005 11:56:18 +0000 (UTC)
| In-Reply-To: <Zp************ **@TK2MSFTNGXA0 2.phx.gbl>
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
Gecko/20051111 Firefox/1.5,gzip(gfe),g zip(gfe)
| Complaints-To: gr**********@go ogle.com
| Injection-Info: f14g2000cwb.goo glegroups.com; posting-host=83.141.121 .205;
| posting-account=UaxKfw0 AAAA4oMLJHydK19 5yIv1avAma
| Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-onli
ne.de!news.glor b.com!postnews. google.com!f14g 2000cwb.googleg roups.com!not-fo
r-mail
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3656 70
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| philip, many thanks for the examples.
| steven, thanks also for the reply. i have narrowed down my problem,
| and i am quite sure at this stage that i have encountered a bizarre
| behaviour/bug/feature/whatever.
|
| if you take your sample page that you made, and add the following
| attributes to the 2 button fields:
| ButtonType="ima ge" ImageUrl="MoveU p.gif"
|
| if you debug your code then, you will see Page_Load gets invoked twice,
| and so does RowCommand. that's the only change i made, and when i go
| back to your original version with the text/button columns, it works
| fine. this is an empty web project with one aspx page so there are no
| unusual config problems.
|
| it is very frustrating!! i hope you can shed some light on this
| behaviour.
| thanks
| tim
|
|

Dec 20 '05 #7
hi Steven,
i sent the solution to your newsgroup email address without the
'online'. hope it gets through.
thanks
tim

Dec 20 '05 #8
Hi Tim,

I have tested the project you sent me, however, it seems that I still get
the Page_Load and GridView's OnRowCommand event handler fired once (page's
AutoWireupEvent turn on). Have you checked the IIS log when you performing
the gridView's postback command to see whether there're any other log
entries mapped to that page?
Also, if possible, you can also try the same page on some other machine or
create a new project to perform the same test...

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Tim_Mac" <ti*@mackey.i e>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Subject: Re: help please on GridView commands + AutoEventWireUp , firing
twi
| Date: 20 Dec 2005 05:03:45 -0800
| Organization: http://groups.google.com
| Lines: 6
| Message-ID: <11************ *********@z14g2 000cwz.googlegr oups.com>
| References: <11************ **********@z14g 2000cwz.googleg roups.com>
| <11************ **********@f14g 2000cwb.googleg roups.com>
| <18************ **@TK2MSFTNGXA0 2.phx.gbl>
| NNTP-Posting-Host: 83.141.121.205
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google. com 1135083830 5044 127.0.0.1 (20 Dec 2005
13:03:50 GMT)
| X-Complaints-To: gr**********@go ogle.com
| NNTP-Posting-Date: Tue, 20 Dec 2005 13:03:50 +0000 (UTC)
| In-Reply-To: <18************ **@TK2MSFTNGXA0 2.phx.gbl>
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
Gecko/20051111 Firefox/1.5,gzip(gfe),g zip(gfe)
| Complaints-To: gr**********@go ogle.com
| Injection-Info: z14g2000cwz.goo glegroups.com; posting-host=83.141.121 .205;
| posting-account=UaxKfw0 AAAA4oMLJHydK19 5yIv1avAma
| Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-onli
ne.de!border2.n ntp.dca.giganew s.com!border1.n ntp.dca.giganew s.com!nntp.giga n
ews.com!postnew s.google.com!z1 4g2000cwz.googl egroups.com!not-for-mail
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3659 29
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| hi Steven,
| i sent the solution to your newsgroup email address without the
| 'online'. hope it gets through.
| thanks
| tim
|
|

Dec 21 '05 #9
hi Steven,
thanks for continuing to look into it. i have just tried it on my
production server, windows 2003 enterrprise, asp.net 2. and i get the
same behaviour, double events for postback.
i found the system log to be a reliable way to record the behaviour of
each event execution. this rules out any debugger anomalies etc.

the output from the IIS log shows the double requests. the log
activity consists of one access to the page, followed by a click on the
move-down button, which as you can see triggers two POST events at the
same time, both with IIS status 200.

#Fields: date time cs-method cs-uri-stem cs-uri-query s-port
cs-username c-ip cs-version cs(User-Agent) sc-status sc-substatus
sc-win32-status sc-bytes
2005-12-21 14:58:57 GET /EventWireupPage .aspx - 8090 - xx.yyy.zzz.zzz
HTTP/1.1
Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.2;+SV 1;+.NET+CLR+1.1 .4322;+.NET+CLR +2.0.50727)
200 0 0 35998
2005-12-21 14:58:57 GET /MoveDown.gif - 8090 - xx.yyy.zzz.zzz HTTP/1.1
Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.2;+SV 1;+.NET+CLR+1.1 .4322;+.NET+CLR +2.0.50727)
404 0 2 1795
2005-12-21 14:59:00 POST /EventWireupPage .aspx - 8090 - xx.yyy.zzz.zzz
HTTP/1.1
Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.2;+SV 1;+.NET+CLR+1.1 .4322;+.NET+CLR +2.0.50727)
200 0 64 0
2005-12-21 14:59:00 POST /EventWireupPage .aspx - 8090 - xx.yyy.zzz.zzz
HTTP/1.1
Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.2;+SV 1;+.NET+CLR+1.1 .4322;+.NET+CLR +2.0.50727)
200 0 0 39927
2005-12-21 14:59:00 GET /MoveDown.gif - 8090 - xx.yyy.zzz.zzz HTTP/1.1
Mozilla/4.0+(compatible ;+MSIE+6.0;+Win dows+NT+5.2;+SV 1;+.NET+CLR+1.1 .4322;+.NET+CLR +2.0.50727)
404 0 2 1795

my updated code is below, i didn't make any other changes:
public partial class EventWireupPage : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
System.Diagnost ics.EventLog.Wr iteEntry("ASPNE T", "Page_Load" );
}

protected void GridView1_RowCo mmand(object sender,
GridViewCommand EventArgs e)
{
System.Diagnost ics.EventLog.Wr iteEntry("ASPNE T",
"GridView1_RowC ommand");
}
}

by the way, the only way i noticed it was because of a swap routine
with the move up/down buttons, which obviously when you execute the
same swap twice, it does not change the ordering of the items. if you
use tracing it only shows the trace for one of the postbacks, and
similarly response.Write does not help, so the event log is a sure way
to track it. the event log shows an event for Page_Load corresponding
to the first page access, then there are 2 Page_Load events and 2
RowCommand events, corresponding to the postback(s).

i'm grateful for any more clues you may have to try and get to the
bottom of this.
thanks
tim

Dec 21 '05 #10

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

Similar topics

3
4904
by: Peter Row | last post by:
Hi, I have created a user control consisting of a textbox and a separate vertical scroll bar. The textbox is filled with data. However there could be lots of data so I only fill the textbox with enough to fill the space visible without scrolling. Having set the min and max values of my separate vertical scrollbar I use that to scroll the data. So for example the textbox could be displaying 50 lines of data but in actual fact there is...
1
1123
by: thomson | last post by:
Hi All, i have written a Web application program, in the page load i have given Response.write=("true") if in the page attribute, the default is AutoEventWireup="false", when i run the program, it shows true as output, executes once But if i keep AutoEventWireup="true", it gives me the result truetrue, that means it is executing twice, Can any one explain me why is it so
0
2288
by: Aws | last post by:
My crazy GridView !! I am using Visual Studio 2005, I have a problem with my GridView. I have one access .mdb table and when I update a record on the table EVERYTHING is perfect. I made a Web Setup Project and installed My Web Application on my Localhost and it works perfectly. When I install My Web Application on our “Production Server” it just doesn’t update the records on Edit mode!!!
5
2762
by: Siva | last post by:
Hello I have a dropdownlist inside the gridview as a template column defined as follows: <asp:TemplateField HeaderText="Choose Location"> <ItemTemplate> <asp:DropDownList ID="ddlChooseLoc" runat="server"> </asp:DropDownList> </ItemTemplate> </asp:TemplateField> I have the gridview inside of a master page- content hierarchy.
6
28163
by: Kevin Attard | last post by:
I am using a GridView inside a UserControl which has a template column for deleting the rows. Before databinding the gridview i am attaching the RowCommand and RowDataBound event. I am using the RowDataBound event to set the commandargument of the delete button. The event is being fired and works fine. When I press the delete button, the RowCommand event is not firing! and neither is the RowDeleting (the button's commandName is...
3
11716
by: AG | last post by:
Below is code (slightly modified and converted to VB) that was provided to me in response to another post. I am using it to demonstrate another problem. In order for paging and other features to work properly in a gridview, viewstate must be enabled. So, in order to minimize the size of viewstate for a page, I will sometimes turn off viewstate for each control in template columns. That means that the gridview must be databound on each...
8
18084
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to display data in a "GridView" which is tied to an "ObjectDataSource". In turn, this ObjectDatasource gets it's data from a strongly-typed business object within my code.
2
11035
by: John007 | last post by:
I am using a GridView in ASP.Net 2.0 to Insert, Edit, Update and Delete. I am using ItemTemplate and EditItemTemplate and the buttons are LinkButtons. I am inserting a new row from the footer. The RowCommand event is firing twice when I hit the Edit, Update, Delete and Insert buttons. The AutoEventWireup is set to false. What am I missing? Thanks.
5
1931
by: Josephine | last post by:
HI experts, I am new in asp.net. I used Visual Studion 2005 and MS Access 2003 to build aspx files. I used the VS 2005 "DetailView" and "GridView" that has INSERT, EDIT, DELETE function. It is working on my local drive but when i posted it to my web server and I got this error. Can anyone help/assist me? Billion thanks. -----------------------file script---------------------------- <%@ Page Language="VB" AutoEventWireup="false"...
0
8913
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6016
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.