Last post Aug 02, 2007 02:49 PM by jrnail23
Aug 01, 2007 10:43 PM|jrnail23|LINK
I have a user control which contains an UpdatePanel, which contains a MultiView inside, with a GridView in one of the views.
In my GridView, I have a ButtonField which is supposed to trigger a server-side operation, using the RowCommand functionality.
In IE, this all works great, but in Firefox (v18.104.22.168), clicking the above mentioned ButtonField fires off two similar AJAX requests, which is causing errors in my server-side code.
Background Info: the gridview displays a list of external contact records, so the user can link to the contact record currently displayed on the page (by clicking a ButtonField in the GridView). During the process of adding the link, my server-side code
checks to see if the external contact has already been linked to one of our contacts. Once the link has been successfully created, the external contact's personal info is displayed in a details view. On the other hand, if the external contact has been linked
to one of our contacts already, the user is prompted to either cancel the operation, delete the existing link & continue, or continue by allowing a duplicate link to be created. Once the user selects the appropriate option, a details view is displayed showing
the newly linked external contact's personal info (if the operation is cancelled, the user is returned to a search criteria form).
In IE, all this works as expected, but in Firefox, when I click my ButtonField, the server-side code executes as expected, adding the link. The weird part is that after adding the link, it tries to add the link again, which of course brings up my user prompt
to handle the potential duplicate. From working with FireBug and debugging in VS2005, it looks like two separate AJAX postbacks are being fired off at pretty much the same time, with one arriving at the server before the 2nd one (the first one is creating
the contact link as expected, and the 2nd one is getting caught on my duplicate-checking user prompt). I'd imagine that if I didn't have that duplicate-checking user, this thing could go into an infinite loop.
Does anyone know why or how this is happening? Is this a known issue with ASP.NET AJAX or Firefox? Is there anyway to work-around this issue?
firefox mozilla behaviors ajax asp.net
AJAX 1.0 UpdatePanel
Aug 02, 2007 03:14 AM|gt1329a|LINK
I had this problem recently as well. It's a known problem with command fields in GriwViews, unrelated to AJAX. Switch to a template field with the same button and it should work correctly. For example, this template replicates the standard edit/update/cancel
command field column, without the double postbacks:
<asp:ImageButton runat="server" ID="EditButton" CommandName="Edit" ImageUrl="~/Images/edit-wide.png"
CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' OnCommand="EquipmentList_RowEditing" />
<asp:ImageButton runat="server" ID="UpdateButton" CommandName="Update" ImageUrl="~/Images/ok.gif"
CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' OnCommand="EquipmentList_RowUpdating" />
<asp:ImageButton runat="server" ID="CancelButton" CommandName="Cancel" ImageUrl="~/Images/cancel.gif"
CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' OnCommand="EquipmentList_CancelEditing" />
Aug 02, 2007 06:50 AM|chetan.sarode|LINK
Thanks, it will help for me
Aug 02, 2007 02:49 PM|jrnail23|LINK
gt1329a, you saved my life. I just wish I had posted this question BEFORE beating my head against a wall for 8 hrs, trying to figure it out myself!