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_RowCommand.
if i set AutoEventWireup=false, PageLoad doesn't fire (as is expected)
and GridView1_RowCommand 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="TestGridView.aspx.cs" Inherits="Admin_TestGridView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="PageID"
DataSourceID="dsPages"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:BoundField DataField="TitleForEdit"
HeaderText="Title" />
<asp:ButtonField ButtonType="Image"
CommandName="MoveUp" ImageUrl="../Images/Move_Up.gif"
Text="Move this page up one position" />
<asp:ButtonField ButtonType="Image"
CommandName="MoveDown" ImageUrl="../Images/Move_Down.gif"
Text="Move this page down one position" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="dsPages" runat="server"
SelectMethod="Select" TypeName="PageManager">
</asp:ObjectDataSource>
</form>
</body>
</html>
********** CODE BEHIND ***********
public partial class Admin_TestGridView : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_Load<HR>");
}
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
Response.Write("GridView1_RowCommand<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
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
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
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/library/ms178472(en-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/aspnet20/AutoEventWireUp_True_Error.aspx
2- In this demo the AutoEventWireUp is set to true and everything works as
expected
http://www.webswapp.com/CodeSamples/aspnet20/AutoEventWireUp_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/aspnet20/AutoEventWireUp_False.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
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="EventWireupPage.aspx.cs" Inherits="EventWireupPage" Trace="true"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:LocalNorthWind %>"
SelectCommand="SELECT [CategoryID], [CategoryName],
[Description] FROM [Categories]">
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="CategoryID"
DataSourceID="SqlDataSource1"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:BoundField DataField="CategoryID"
HeaderText="CategoryID" InsertVisible="False"
ReadOnly="True" SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName"
HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:ButtonField CommandName="MoveUp" Text="MoveUp" />
<asp:ButtonField CommandName="MoveDown" Text="MoveDown" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
==========code behind==========
public partial class EventWireupPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Trace.Write("Page_load " + DateTime.Now.ToLongTimeString() );
}
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
Trace.Write("RowCommand " + e.CommandName + " " +
DateTime.Now.ToLongTimeString());
}
}
====================
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+3hSkc5a7PT+ar2/nTIb7cww==
| X-WBNR-Posting-Host: 70.68.38.48
| From: "=?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?="
<Phillip....@webswapp.com>
| References: <1134758479.7...@z14g2000cwz.googlegroups.com>
<B6B3368E-89E6-4569...@microsoft.com>
<1134934933.0...@g44g2000cwa.googlegroups.com>
| Subject: Re: help please on GridView commands + AutoEventWireUp, firing
twi
| Date: Sun, 18 Dec 2005 20:34:02 -0800
| Lines: 56
| Message-ID: <D92809EE-6E38-417E...@microsoft.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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365626
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
if you take your sample page that you made, and add the following
attributes to the 2 button fields:
ButtonType="image" ImageUrl="MoveUp.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
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_OnRowCommand 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="EventWireupPage.aspx.cs" Inherits="EventWireupPage" Trace="false"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:LocalNorthWind %>"
SelectCommand="SELECT [CategoryID], [CategoryName],
[Description] FROM [Categories]">
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataKeyNames="CategoryID"
DataSourceID="SqlDataSource1"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:BoundField DataField="CategoryID"
HeaderText="CategoryID" InsertVisible="False"
ReadOnly="True" SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName"
HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:ButtonField CommandName="MoveUp" ButtonType=image
ImageUrl="~/Images/menu_pop_dynamic.GIF" Text="MoveUp" />
<asp:ButtonField CommandName="MoveDown" ButtonType=image
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" <t...@mackey.ie>
| Newsgroups: microsoft.public.dotnet.framework.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: <1134993372.7...@f14g2000cwb.googlegroups.com>
| References: <1134758479.7...@z14g2000cwz.googlegroups.com>
| <B6B3368E-89E6-4569...@microsoft.com>
| <1134934933.0...@g44g2000cwa.googlegroups.com>
| <D92809EE-6E38-417E...@microsoft.com>
| <ZpDav2GB...@TK2MSFTNGXA02.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: groups...@google.com
| NNTP-Posting-Date: Mon, 19 Dec 2005 11:56:18 +0000 (UTC)
| In-Reply-To: <ZpDav2GB...@TK2MSFTNGXA02.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),gzip(gfe)
| Complaints-To: groups...@google.com
| Injection-Info: f14g2000cwb.googlegroups.com; posting-host=83.141.121.205;
| posting-account=UaxKfw0AAAA4oMLJHydK195yIv1avAma
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!news.glorb.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-fo
r-mail
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365670
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
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" <t...@mackey.ie>
| Newsgroups: microsoft.public.dotnet.framework.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: <1135083825....@z14g2000cwz.googlegroups.com>
| References: <1134758479.7...@z14g2000cwz.googlegroups.com>
| <1134993372.7...@f14g2000cwb.googlegroups.com>
| <18otl#UBGHA...@TK2MSFTNGXA02.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: groups...@google.com
| NNTP-Posting-Date: Tue, 20 Dec 2005 13:03:50 +0000 (UTC)
| In-Reply-To: <18otl#UBGHA...@TK2MSFTNGXA02.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),gzip(gfe)
| Complaints-To: groups...@google.com
| Injection-Info: z14g2000cwz.googlegroups.com; posting-host=83.141.121.205;
| posting-account=UaxKfw0AAAA4oMLJHydK195yIv1avAma
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365929
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
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;+Windows+NT+5.2;+SV1;+.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;+Windows+NT+5.2;+SV1;+.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;+Windows+NT+5.2;+SV1;+.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;+Windows+NT+5.2;+SV1;+.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;+Windows+NT+5.2;+SV1;+.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.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Diagnostics.EventLog.WriteEntry("ASPNET", "Page_Load");
}
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
System.Diagnostics.EventLog.WriteEntry("ASPNET",
"GridView1_RowCommand");
}
}
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
http://groups.google.com/groups?q=sc-win32-status+64&qt_s=Search
It sounds very strange that there occurs two requests each time (since the
IIS log shows two POST entries each time....), I've also discussed with
our IIS engineer, I think we may need to use some http or TCP trace tool to
capture the two requests... Is the "two request" behavior always occuring
both when we request the page from local server or from a remote client
machine?
There're some http/tcp trace tools like the Trace Utility in soap toolkit
or tcptrace....:
SOAP TOOLKIT 3.0
http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-
9753-86F052EC8450&displaylang=en
tcptrace
http://www.pocketsoap.com/tcptrace/
Also, if you have any other trace tools which can catpure http request,
that'll be ok. We need to capture the http message's content to see what's
the difference between them. Also, if the problem also occur on other
remote client, we can also confirm whether the two request are caused by
client browser or serverside....
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" <t...@mackey.ie>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Re: help please on GridView commands + AutoEventWireUp, firing
twi
| Date: 21 Dec 2005 09:09:18 -0800
| Organization: http://groups.google.com
| Lines: 9
| Message-ID: <1135184958.5...@z14g2000cwz.googlegroups.com>
| References: <1134758479.7...@z14g2000cwz.googlegroups.com>
| <1135083825....@z14g2000cwz.googlegroups.com>
| <Yh#xV7iBG...@TK2MSFTNGXA02.phx.gbl>
| <1135177838.6...@g49g2000cwa.googlegroups.com>
| NNTP-Posting-Host: 83.141.121.205
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1135184963 5422 127.0.0.1 (21 Dec 2005
17:09:23 GMT)
| X-Complaints-To: groups...@google.com
| NNTP-Posting-Date: Wed, 21 Dec 2005 17:09:23 +0000 (UTC)
| In-Reply-To: <1135177838.6...@g49g2000cwa.googlegroups.com>
| 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),gzip(gfe)
| Complaints-To: groups...@google.com
| Injection-Info: z14g2000cwz.googlegroups.com; posting-host=83.141.121.205;
| posting-account=UaxKfw0AAAA4oMLJHydK195yIv1avAma
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.gigan
ews.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:366303
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
i set up TcpTrace, and recorded 2 different log files, one while
browsing with IE6, and the other with FF. you can download them here:
http://tim.mackey.ie/stuff/IE_dud_postback.xml
http://tim.mackey.ie/stuff/FF_OK_PostBack.xml
The first file "IE_Dud_postback" shows 5 connections, i will summarise
below:
+ GET aspx page
+ GET the image
+ POST aspx page, note that bytes are sent but no bytes are received
back by the client
+ POST aspx page, this is the second postback, which gets a response
from the server.
+ GET the image
from debugging and event logging etc, i am 100% certain that .Net
executes Page_Load and GridView_RowCommand for both of those postbacks.
i'm using the same code as i posted previously.
the firefox sequence of events is as expected, only one postback. this
only seems to happen on ButtonField's with ButtonType="Image"
is there any more information i can provide? if i found a really big
bug do i get a prize? :)
tim
Just to let you know, Tim, that YOU ARE NOT ALONE!!! We've been
developping Web applications with .NET 2.0 and are struggling with the
same undocumented features.
The workaround we are using is based on the fact that the correct
request includes the same POST-data of the first request together with
extra values. These values are coordinates of the click on the image of
the ButtonField, if you are using the ButtonType set to Image, ofcourse.
<asp:ButtonField ButtonType="Image" ... />
To detect the second / good post, you can simply check the presence of
the Request-variables "x" and "y":
if(this.Request["x"]==null || this.Request["y"]==null)
{ // This is fake }
These variables should contain integer-positions of the click on the
image and this is the behavior in FireFox, Opera and Internet Explorer.
We didn't test on other clients nor systems, though.
Any decent way to avoid this problem is welcome!
I hope this can help you and I hope Steven can give us an official tip!
Wim
*** Sent via Developersdex http://www.developersdex.com ***
a sample of the scenario where i use the work-around code is as
follows:
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "MoveUp":
// check for bogus postback from ImageButton
if(this.Request["x"] == null && this.Request["y"] == null)
Response.End();
....
I appreciates the solution if(...=null..&& ..=null)
but i think it's not possible. If it's a bug microsoft have to solve!
Ema
Yes, the request is at least 8 bytes longer, depending on the image
coordinates. The querystring for small coordinates (lower then 10) is
for example: &x=5&y=7. This means an increase of 8 bytes. If the
coordinates are heigher, this will result in more bytes, eg. &x=14&y=30
is a total of 10 bytes.
The quick-hack work-around unprofessional solution is not acceptable,
but we are waiting for any comments from Microsoft! Go Bill, go Bill!
Greetings,
Wim Verbeke
Have someone understood when it happens (for me it is random!)??
2.If it's related with imagebutton why I haven't using only imagebutton
without gridview?
Ema
if (Request["x"] == null && Request["y"] == null && (e.CommandName ==
"MoveUp" || e.CommandName == "MoveDown"))
Response.End();
In RowEditing i use:
if (Request["x"] == null && Request["y"] == null)
Response.End();
Thanks for reporting the issue. This is a known issue and we are
investigating fixing this in the next service pack. For the time being
you could use the following work around. One obvious workaround is to
change the button type to a regular button or a link button. If you need
an ImageButton, then you can put an ImageButton in a TemplateField. You
may need to handle the Command event on the ImageButton and call
DeleteRow, passing the RowIndex as the CommandArgument, like this:
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton runat=server id="ImageButton1" CommandName="Delete"
ImageUrl="..." CommandArgument='<%# DataBinder.Eval(Container,
"RowIndex") %>' OnCommand="ImageButton1_Command" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void ImageButton1_Command(object sender, CommandEventArgs e) {
GridView1.DeleteRow(Int32.Parse(e.CommandArgument.ToString()));
}
Thanks,
The Web Platform and Tools Team
You can find discussion in the site in the previous post or to
http://forum.aspitalia.com/forum/post/259149/GridviewImagebutton.aspx
Ema
Is the Gridview command issue you mentioned here means the double postback
behavior of ImageButton in GridView command field? So far, there is only an
existing issue of this. You can have a look at the following newsgroup
thread to see whether the problem you met is exact the one there:
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webc
ontrols/browse_thread/thread/a9a1bd53c27bd8b0/82c51830597e5fc8
Also, for this issue, there is already a public bug entry on the product
feedback center(also recorded in internal bug database):
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
kid=105123
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Is the bug entry I posted in last message the one meet your scenario?
Please feel free to let me know if there is anything else we can help.