Code not running in Firefox

2 posts, 0 answers
  1. William
    William avatar
    55 posts
    Member since:
    Sep 2008

    Posted 05 Oct 2011 Link to this post

    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

     

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4630 posts

    Posted 07 Oct 2011 Link to this post

    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
Back to Top