This is a migrated thread and some comments may be shown as answers.

Code not running in Firefox

1 Answer 49 Views
Window
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 05 Oct 2011, 03:53 PM

I'm opening a radWindow using hyperlink in a grid

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
       
       If TypeOf e.Item Is GridDataItem Then
         
           Dim item As GridDataItem = CType(e.Item, GridDataItem)
           Dim editLink As HyperLink = CType(e.Item.FindControl("HyperLink1"), HyperLink)
           editLink.Attributes("href") = "#"
           editLink.Attributes("onclick") = "return openWin('/portals/0/NewEducation.aspx?RecID=" + item.GetDataKeyValue("RecID").ToString() + "'); "
  
   End Sub

I then register a button on the new window in the page load

bnSubmit.Attributes("onclick") = "return CloseAndRebind('rebind'); return true;"

I also have code that updates the database when the Submit button is clicked.  Everything works fine in IE9 and Safari but when I run it in Firefox the bnSubmit_Click codes does not run and the window just closes.  If I remove the bnSubmit attribute is there code that I can put in after the bnSubmit.Click that will close the window after I run all of the server side code?

Thanks

Bill

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 07 Oct 2011, 01:14 PM
Hello William,

This seems like an issue with the way you attach the handler and the way different browsers interpret the returned value. Usually a postback is cancelled via adding return false; after the function call, yet you return true. If your function also returns true/false this may lead to a contradiction. I advise that you check this behavior with regular controls, as this does not seem related to the RadWinow in any way.

If you need the server-side functionality what you can do is:
1. add the server-side handler with the needed logic
2. remove (do not add) the client-side handler
3. declare the CloseAndRebind() function in the page you load in the RadWindow nevertheless
4. Inject the call to this function from the code-behind of the button;s Click. How to do this is explained in this help article. The said function can also get a reference to the RadWindow and call its close() method.


Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Window
Asked by
William
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or