PostBack / AutoPostBack / NavigateURL problems

5 posts, 1 answers
  1. Chris
    Chris avatar
    35 posts
    Member since:
    Mar 2008

    Posted 08 Oct 2009 Link to this post

    I am using Q1 2009 release of the ASP.NET Ajax toolset. I have created a toolbar and when I attempt to set a Navigate URL with a specified target, the Navigate works great but it opens in both the parent window and the new window. Am I doing something wrong here!?

                <telerik:RadToolBar ID="tbTicketDetails" runat="server" Width="100%" AutoPostBack="true">  
                    <Items> 
                        <telerik:RadToolBarButton runat="server" Text="Add Notes" ImageUrl="~/Images/notebook_pencil.png" 
                            Value="AddNotes" CommandName="AddNotes" OnLoad="GetItemURL">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Close" ImageUrl="~/Images/door.png" 
                            Value="CloseTicket" CommandName="CloseTicket" OnLoad="GetItemURL">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Lock" ImageUrl="~/Images/lock.png" 
                            Value="LockTicket" CommandName="LockTicket">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Unlock" ImageUrl="~/Images/lock_unlock.png" 
                            Value="UnlockTicket" CommandName="UnlockTicket">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Claim Ticket" CommandName="ClaimTicket" 
                            ImageUrl="~/Images/card_claimticket.png" Value="ClaimTicket">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Release Ticket" CommandName="ReleaseTicket" 
                            ImageUrl="~/Images/card_releaseticket.png" Value="ReleaseTicket">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Assign Ticket" CommandName="AssignTicket" 
                            ImageUrl="~/Images/card__assignticket.png" Value="AssignTicket" OnLoad="GetItemURL">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Move Ticket" CommandName="MoveTicket" 
                            ImageUrl="~/Images/pin_moveticket.png" Value="MoveTicket" OnLoad="GetItemURL">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Reopen Ticket" CommandName="ReopenTicket" 
                            Value="ReopenTicket" ImageUrl="~/Images/reopenticket.png" OnLoad="GetItemURL" /> 
                        <telerik:RadToolBarButton runat="server" Text="Delete Ticket" CommandName="DeleteTicket" 
                            ImageUrl="~/Images/delete.png" Value="DeleteTicket">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Restore Ticket" CommandName="RestoreTicket" 
                            ImageUrl="~/Images/restore.png" Value="RestoreTicket">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Edit Ticket Details" CommandName="EditDetails" 
                            ImageUrl="~/Images/ticket_pencil.png" Value="EditDetails" Visible="false" OnLoad="GetItemURL">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Assign Goal" CommandName="AssignGoal" 
                            ImageUrl="~/Images/accreditationgoal.png" Value="AssignGoal" OnLoad="GetItemURL">  
                        </telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" IsSeparator="true"></telerik:RadToolBarButton> 
                        <telerik:RadToolBarButton runat="server" Text="Print" CommandName="PrintWorkOrder" 
                            ImageUrl="~/Images/print.png" Value="Print" OnLoad="GetItemURL" Target="_blank" PostBack="false"></telerik:RadToolBarButton> 
                    </Items> 
                </telerik:RadToolBar> 
     

    And here is the OnLoad event handler that sets the Navigate URL -- the button with the problem is the last button "Print".
        Protected Sub GetItemURL(ByVal sender As ObjectByVal e As System.EventArgs)  
            Dim item As Telerik.Web.UI.RadToolBarButton  
            If sender.GetType Is GetType(Telerik.Web.UI.RadToolBarButton) Then 
                item = DirectCast(sender, Telerik.Web.UI.RadToolBarButton)  
                Select Case item.Value  
                    Case "AddNotes" 
                        item.NavigateUrl = "NoteEditor.aspx?TID=" & TicketID & "&MD=E" 
                    Case "CloseTicket" 
                        item.NavigateUrl = "CloseWorkOrder.aspx?TID=" & TicketID  
                    Case "AssignTicket" 
                        item.NavigateUrl = "NoteEditor.aspx?TID=" & TicketID & "&MD=A" 
                    Case "MoveTicket" 
                        item.NavigateUrl = "NoteEditor.aspx?TID=" & TicketID & "&MD=M" 
                    Case "EditDetails" 
                        item.NavigateUrl = "EditTicketDetails.aspx?TID=" & TicketID  
                    Case "AssignGoal" 
                        item.NavigateUrl = "UpdateAccreditationGoal.aspx?TID=" & TicketID  
                    Case "ReopenTicket" 
                        item.NavigateUrl = "ReopenTicket.aspx?TID=" & TicketID  
                    Case "Print" 
                        item.NavigateUrl = "PrintTicketView.aspx?TID=" & TicketID  
                        item.Target = "_blank" 
                End Select 
                item.PostBack = False 
            End If 
        End Sub 
     

    When I click on the print button, the URL is opened in a new window plus the parent window. Am I doing something wrong here?
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 12 Oct 2009 Link to this post

    Hi Chris,

    This issue is already fixed in Q2 release of RadControls, could you please download it and give it a try?

    Regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris
    Chris avatar
    35 posts
    Member since:
    Mar 2008

    Posted 21 Oct 2009 Link to this post

    I would love to upgrade, but our organization is locked into 2009 Q1 at the moment as all of our internal projects using these tools are not to be beyond this version. We will be considering an upgrade after January 2010, so are there any work arounds that are available?
  5. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 23 Oct 2009 Link to this post

    Hi Chris,

    Please subscribe to OnClientButtonClicking event of the toolbar and in its handler:

    <script type="text/javascript">
        function buttonClicking(sender, args) {
            if (args.get_item().get_linkElement().target == "_blank") {
                args.set_cancel(true);
                window.open(args.get_item().get_navigateUrl());
            }
        }
    </script>

    Best regards,
    Yana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Chris
    Chris avatar
    35 posts
    Member since:
    Mar 2008

    Posted 13 Nov 2009 Link to this post

    Great suggestion! Thanks!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017