More in this section

Forums / General Discussions / Response.Redirect(url) problem

Response.Redirect(url) problem

7 posts, 1 answered
  1. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    27 Dec 2010
    Link to this post
    I'm having an issue attempting to redirect from one Sitefinity page to another. I have a page that sits at the following Sitefinity URL: http://schqvbid/eis/requests

    It has a user control on it that contains a button. The button executes code and then performs a Response.Redirect(url); where url is a string variable set to "~/eis/request" which is another Sitefinity page.

    When the code executes, it forms the url string as: http://schqvbid/eis/%2feis%2frequest%2f

    I've tried changing my url string to every possible combination that I can think of to get it to redirect to http://schqvbid/eis/request.

    What am I missing here? What is the correct way to navigate to a Sitefinity page using a redirect?

    Thanks.
  2. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    27 Dec 2010
    Link to this post
    a little more information that I figured out...

    The problem only happens when the RadGrid is ajaxified. If I remove the RadAjaxManagerProxy section, the link forms fine and I can redirect.

    Is there a setting I need to add to my RadAjaxManager or RadAjaxManagerProxy to get links to form normally?
  3. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    27 Dec 2010
    Link to this post
    Another update...

    I had been having the issue with pages that contain my User Controls and a custom Master Page needing a <asp:ScriptManager> tag on my Master Page or they would error out. Removing that tag from my Master Page doesn't cause the error any more and doing so also corrects the behavior with the Redirect url. Of course I lost all AJAX functionality on my pages as well which is probably why it also works when I remove the RadAjaxManagerProxy from this page.
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    28 Dec 2010
    Link to this post
    Hi Philip Senechal,

    It would be nice if you showed us some sample code on how you are handling the link as well as how you use your user control with RadAjaxManager. This will help us troubleshoot the error.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    28 Dec 2010
    Link to this post
    Of course...forgive me for not including the relevant sections in my original post.

    top of my custom Master Page
    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="InfoSource.master.cs"
        Inherits="SitefinityWebApp.InfoSource" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server">
        <title></title>
    </head>
    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportTo") >= 0)
                args.set_enableAjax(false);
        }
    </script>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" ClientEvents-OnRequestStart="onRequestStart"
            runat="server" />
        <telerik:RadFormDecorator DecoratedControls="All" Skin="Default" runat="server" />

    Ajax settings from my user control
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btn_Assign">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadButton1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="Default" runat="server" />

    RadGrid declaration with the first column where the link is created
    <telerik:RadGrid ID="RadGrid1" Skin="Default" GridLines="None" AutoGenerateColumns="false"
        GroupingEnabled="true" AllowSorting="true" AllowFilteringByColumn="true" ShowGroupPanel="true"
        ShowFooter="true" ItemStyle-VerticalAlign="Top" AlternatingItemStyle-VerticalAlign="Top"
        AlternatingItemStyle-BackColor="#efefef" OnPreRender="RadGrid1_PreRender" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnItemCreated="RadGrid1_ItemCreated"
        OnItemDataBound="RadGrid1_ItemDataBound" OnInsertCommand="RadGrid1_InsertCommand"
        OnExcelMLExportRowCreated="RadGrid1_ExcelMLExportRowCreated" OnExcelMLExportStylesCreated="RadGrid1_ExcelMLExportStylesCreated"
        runat="server">
        <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
            <Excel Format="ExcelML" />
        </ExportSettings>
        <MasterTableView Name="Master" DataKeyNames="ReqID, ReqEmpID, AnlysEmpID" CommandItemDisplay="Top"
            GroupsDefaultExpanded="false" HierarchyLoadMode="ServerOnDemand" HierarchyDefaultExpanded="false"
            Font-Size="11px" NoMasterRecordsText="There are no Requests that match the criteria"
            UseAllDataFields="true">
            <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordImageUrl="~/Sitefinity/WebsiteTemplates/InfoSource/App_Themes/InfoSource/Images/ico_add_24.png"
                AddNewRecordText="Add a Request" ShowExportToExcelButton="true" ExportToExcelImageUrl="~/Sitefinity/WebsiteTemplates/InfoSource/App_Themes/InfoSource/Images/ico_excel_24.png"
                ExportToExcelText="Export to Excel" ShowExportToPdfButton="true" ExportToPdfImageUrl="~/Sitefinity/WebsiteTemplates/InfoSource/App_Themes/InfoSource/Images/ico_acrobat_24.png"
                ExportToPdfText="Export to PDF" ShowRefreshButton="true" RefreshImageUrl="~/Sitefinity/WebsiteTemplates/InfoSource/App_Themes/InfoSource/Images/ico_refresh_24.png"
                RefreshText="Refresh" />
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Request #" DataField="ReqNm" UniqueName="ReqNm"
                    Groupable="false" SortExpression="ReqID" AllowFiltering="true">
                    <HeaderStyle Wrap="false" />
                    <ItemStyle Wrap="false" />
                    <ItemTemplate>
                        <asp:LinkButton ID="btn_ReqID" Text='<%# Eval("ReqID") %>' OnClick="btn_ReqID_Click"
                            CommandArgument='<%# Eval("ReqID") %>' runat="server" />
                        <br />
                        <asp:Label ID="lbl_ReqNm" Text='<%# Eval("ReqNm") %>' runat="server" />
                    </ItemTemplate>
                    <FilterTemplate>
                        <telerik:RadComboBox ID="dd_type_filter" Skin="Default" Width="120px" Font-Size="11px"
                            MarkFirstMatch="true" AppendDataBoundItems="true" SelectedValue='<%# (Container as GridItem).OwnerTableView.GetColumn("ReqNm").CurrentFilterValue %>'
                            OnClientSelectedIndexChanged="TypeIndexChanged" runat="server">
                            <Items>
                                <telerik:RadComboBoxItem Text="All" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                            <script type="text/javascript">
                                function TypeIndexChanged(sender, args) {
                                    var tableView = $find("<%# (Container as GridItem).OwnerTableView.ClientID %>");
                                    tableView.filter("ReqNm", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridTemplateColumn>

    and the event that's executed when the link is clicked
    protected void btn_ReqID_Click(object sender, EventArgs e)
    {
        LinkButton btn_ReqID = (LinkButton)sender;
     
        Session["s_ReqID"] = int.Parse(btn_ReqID.CommandArgument.ToString());
     
        string url = "~/eis/request/";
        Response.Redirect(url, true);
    }


    Please let me know if there is any other information you need. Thanks again!
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    29 Dec 2010
    Link to this post
    Hello Philip Senechal,

    Thank you for getting back to me.

    Have you tried this behavior in IE and Chrome? There seems to be no problem with using Response.Redirect. You can also try the bellow:
    void button1_Click(object sender, EventArgs e)
    {
        string url = "~/test/redirect/";
        var AjaxManager = RadAjaxManager.GetCurrent(this.Page);
        AjaxManager.Redirect(url);
    }

    The problem does not appear to be related to the RadAjaxManager or the Ajax controls. The problem seems to be related to this bug in Firefox.


    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  7. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    29 Dec 2010
    Link to this post
    Hi Radoslav,

    Thanks for the reply. IE 7 displays the same behavior as Firefox on my computer. Unfortunately I cannot test Chrome because they won't let us install it on our laptops here.

    I did however use your alternate code solution for the redirect and the problem doesn't appear when using the RadAjaxManager to do the redirect. I will use this solution. Thanks for the assistance.
7 posts, 1 answered