Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET AJAX GridView in UpdatePanel problem

Status
Not open for further replies.

Warlocks

Technical User
Jan 9, 2003
79
0
0
GB
Hi,

This seems an odd problem. We have an ASP.NET AJAX UpdatePanel within a UserControl. The UpdatePanel contains a GridView control that binds to a given DataTable to do its work. In order to give the GridView a double-click selection mechanism; the leftmost column is actually created by a hidden ButtonField object. In the GridView’s RowDataBound event, the following code hooks up each row so that it will react to a double click:

e.Row.Attributes("OnDblClick") = Page.ClientScript.GetPostBackClientHyperlink(doubleClickButton, String.Empty)

The only remaining issue is that each double click must initiate a full postback, and not the asyncronous postback that the UpdatePanel would normally produce. The following code takes care of that:

Private Sub LookupGrid_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)

If e.Row.RowType = DataControlRowType.DataRow Then
Dim doubleClickButton As LinkButton = CType(e.Row.Cells(1).Controls(0), LinkButton)
ScriptManager.GetCurrent(Page).RegisterPostBackControl(doubleClickButton)
End If

End Sub

Everything operates exactly as expected, right up until the point that another control is used to initiate an asyncronous postback. As soon as this happens, the use of the RegisterPostBackControl method makes absolutely no difference. All of the double click buttons start to initiate the asyncronous postbacks instead of full postbacks. Interestingly, the only other control within the UpdatePanel that is coded to cause full postbacks always does so without problem. This control is a standard button webserver control, and is outside the GridView control, placed directly inside the UpdatePanel.

Various attempted workarounds haven’t helped, and I’m now really beginning to suspect some sort of bug in the ScriptManager or UpdatePanel component. Does anybody have any insight into this issue?

FYI: We are using VS.NET 2005 sp1 and ASP.NET 2.0 AJAX 1.0 (latest release). My own browser is IE7.0

Any help would be much appreciated.
 
Hi;

Sorry, no resolution, just a suggestion:

Post this in the AJAX forum within the official site. I have found my AJAX related questions get answered quicker there. Also, you may stumble upon someone else who had the same problem.

Regards;

Sean. [peace]
 
Sean,

Thanks anyway for the tip. We will do that...

Woody.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top