+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Create a re-direct after person submits information

Create a re-direct after person submits information

3 posts, 0 answered
  1. Nam
    Nam avatar
    4 posts
    Registered:
    31 Mar 2014
    09 Apr 2014
    Link to this post

    Our developer created a customized eCommerce system where when customers select items in our product listing, the information is sent to us in a form of a contact form/information request -- instead of a normal check out process.

     It works great for us, but we want to redirect to a thank you page after the information is sent. This is important so we can do in-site tracking. Can we add a simple redirect line to the script?

     This is the code of our "shopping" aka "items of interest request" template:

     

    <%@ Control Language="C#" Inherits="Spinbox.Clients.Identisys.Web.UI.Frontend.BasketControl"%>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Assembly="Telerik.Sitefinity.Ecommerce" Namespace="Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.Fields" TagPrefix="sfCatalog" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="orders" Namespace="Telerik.Sitefinity.Modules.Ecommerce.Orders.Web.UI" Assembly="Telerik.Sitefinity.Ecommerce" %>
    <%@ OutputCache Duration="1" VaryByParam="*" %>
    <%@ Import Namespace="Telerik.Sitefinity.Ecommerce" %>
    <%@ Import Namespace="Telerik.Sitefinity.Modules.Ecommerce" %> 
    <%@ Register src="~/Controls/MakeQuoteRequest.ascx" tagname="MakeQuoteRequest" tagprefix="ids" %>
      
    <div class="sfshoppingCartWrp">
        <!-- This container is used to display warning messages about set up of the widget;
             when control is set correctly, this container is invisible -->
        <div id="widgetStatus" runat="server" visible="false" class="sfshoppingCartStatus">
            <asp:Label ID="widgetStatusMessage" runat="server" />
        </div>

        <asp:PlaceHolder id="widgetBody" runat="server">
            <h1 id="widgetHeading" runat="server"><asp:Literal ID="Literal1" runat="server" Text='Items of interest' /></h1>
            <%-- Visible False --%>
            <asp:PlaceHolder runat="server" ID="itemsCountPlaceholder" Visible="false">
                <asp:Literal ID="productsCountLabel" runat="server" Visible="false" />&nbsp;<asp:Literal ID="Literal2" runat="server" Text='<%$Resources:OrdersResources, items %>' Visible="false" />
            </asp:PlaceHolder>
            <%-- Visible False --%>
            <sf:Message runat="server" ID="cartUpdateMessage" />        
            <div id="request_cart">
                <telerik:RadGrid id="shoppingCartGrid" runat="server" Skin="Basic" ShowFooter="False" EnableEmbeddedBaseStylesheet="false" EnableEmbeddedSkins="false">
                    <MasterTableView AutoGenerateColumns="false" DataKeyNames="Id">
                        <Columns>
                            <telerik:GridTemplateColumn ItemStyle-Width="20%" HeaderText='' UniqueName="ProductImage" HeaderStyle-CssClass="sfItmTmbCol">
                                <ItemTemplate>
                                    <div class="rc_img">
                                        <img src='<%# HttpUtility.HtmlAttributeEncode(Eval("ThumbnailUrl") as string) %>' alt='<%# Eval("ThumbnailAlternativeText") %>' class="sfproductTmb" />
                                    </div>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>                                              

                            <%-- Visible False --%>
                            <telerik:GridTemplateColumn UniqueName="BasePrice" ItemStyle-CssClass="sfSingleItmPriceCol" HeaderStyle-CssClass="sfSingleItmPriceCol" Visible="false">
                                <ItemTemplate>
                                    <sfCatalog:DisplayPriceField id="displayPriceField" ObjectType="Cart" ObjectId='<%# Eval("Id") %>' runat="server" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- Visible False --%>  

                            <%-- Visible False --%>
                            <telerik:GridTemplateColumn UniqueName="ProductQuantity" HeaderText="<%$Resources:OrdersResources, Quantity %>" ItemStyle-CssClass="sfItmQuantityCol" HeaderStyle-CssClass="sfItmQuantityCol" Visible="false">
                                <ItemTemplate>
                                        <span>x</span>
                                        <asp:HiddenField ID="cartDetailId" runat="server" />
                                        <asp:TextBox ID="quantity" runat="server" Text='<%# Eval("Quantity") %>' CssClass="sfTxt" />
                                        <asp:RangeValidator ID="quantityValidator" runat="server"
                                            MinimumValue="0"
                                            MaximumValue="9999"
                                            ControlToValidate="quantity"
                                            Type="Integer"
                                            Display="Dynamic" 
                                            CssClass="sfErrorWrp">
                                            <span class="sfError">
                                                <asp:Literal ID="Literal3" runat="server" Text="<%$Resources: OrdersResources, ProductQuantityIsInvalidInShoppingCart %>" />
                                            </span>
                                        </asp:RangeValidator>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- Visible False --%>

                            <%-- Visible False --%>
                            <telerik:GridTemplateColumn UniqueName="NewPrice" HeaderText='<%$Resources:OrdersResources, Price %>' ItemStyle-CssClass="sfItmPriceCol" FooterStyle-CssClass="sfItmPriceCol" HeaderStyle-CssClass="sfItmPriceCol" Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="newPriceLabel" runat="server" Text='<%# Eval("DisplayTotalFormatted") %>' CssClass="sfTxtLbl" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- Visible False --%>                    
                        </Columns>
                        <Columns>
                            <telerik:GridTemplateColumn ItemStyle-Width="55%" HeaderText='<%$Resources:OrdersResources, ProductDescription %>' UniqueName="ProductDescription" ItemStyle-CssClass="cell_border" HeaderStyle-CssClass="cell_border" HeaderStyle-HorizontalAlign="left">
                                <ItemTemplate>                               
                                    <div class="rc_info">
                                        <asp:HyperLink ID="productTitleLink" runat="server" Text='<%# Eval("Title") %>' CssClass="sfItmTitle" />
                                    </div>
                                    <asp:Label ID="OutOfStock" CssClass="sfItemOutOfStockMessage" Text="<%$Resources:OrdersResources, OutOfStock %>" Visible="false" runat="server" />
                                    <asp:Label ID="InventoryChange" CssClass="sfItmTitleInventoryChangeCol" Text="<%$Resources:OrdersResources, InventoryChange %>" Visible="false" runat="server" />
                                    
                                </ItemTemplate>   
                            </telerik:GridTemplateColumn>  
                        </Columns>
                        <Columns>
                            <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="center" ItemStyle-Width="25%" HeaderText='<%$Resources:OrdersResources, ProductOptions %>' UniqueName="Options" ItemStyle-CssClass="sfItmOptionsCol" HeaderStyle-CssClass="sfItmOptionsCol">
                                <ItemTemplate>
                                    <div>
                                        <%--<%# Eval("Options")%>--%>
                                        <div class="rc_options">
                                            <asp:LinkButton ID="removeButton" runat="server" Text='<%$Resources:OrdersResources, Remove %>' CommandName="remove" CssClass="remove" />
                                        </div>
                                    </div>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn> 
                        </Columns>          
                    </MasterTableView>
                </telerik:RadGrid>
                <asp:Placeholder ID="phNoItems" runat="server" Visible="false">
                  <div class="rc_empty_cart">
                    You have no items of interest
                  </div>
                </asp:Placeholder>
            </div>
                
            <div class="rc_buttons">
                <asp:LinkButton ID="clearCart" runat="server" CssClass="rc_clear">
                   Clear items of interest
                </asp:LinkButton>
                <asp:HyperLink ID="hlContinue2" runat="server" Text='Return to browsing' NavigateUrl="#" CssClass="rc_return" Visible="False" />
                <a href="/products" class="rc_return">Return to browsing</a>
            </div>
    <asp:Placeholder ID="phBtn" runat="server" Visible="false">
    <asp:Button ID="checkoutButton" runat="server" Text='Send request' CssClass="sfCheckoutBtn" Visible="false" />
    </asp:Placeholder>          
            <ids:MakeQuoteRequest ID="mqr" runat="server"/>
            <asp:Panel ID="shoppingCartGridFooter" runat="server" CssClass="sfShoppingCartGridFooter sfClearfix">
                <%-- Visible False --%>    
                <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="outerCouponCodeUpdatePanel" Visible="false">
                    <ContentTemplate>
                        <div class="sfShoppingCartCouponEntryField">
                            <orders:CouponCodeEntryView ID="couponCodeEntryView" runat="server" IsChangeMode="False"/>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <%-- Visible False --%>    
             <div class="rc_buttons">
                  <div class="sfshoppingCartBtnsWrp sfClearfix">
                      <asp:HyperLink ID="continueShoppingLink" runat="server" Text='Return to browsing'
                          NavigateUrl="#" CssClass="rc_return" Visible="False" />
                      <a href="/products" class="rc_return">Return to browsing</a>
                  </div>
                </div>
                <%-- Visible False --%> 
                <asp:UpdatePanel runat="server" Visible="false">
                    <ContentTemplate>
                        <div class="sfShoppingCartTotal">
                            <table class="sfShoppingCartDiscountList">
                                <tbody>
                                    <tr runat="server" ID="beforeDiscountRow">
                                        <th>
                                            <asp:Label runat="server" Text="<%$ Resources:OrdersResources, BeforeDiscounts %>" CssClass="sfTxtLbl"/>:
                                        </th>
                                        <td>
                                            <asp:Label ID="totalPrice" runat="server" Text="" CssClass="sfTxtLbl" />
                                        </td>
                                    </tr>
                                    <orders:DiscountList runat="server" ID="discountRows"/>
                                </tbody>
                            </table>
                        </div>
                        <div class="sfTotalRowWrp">
                            <asp:Label ID="productTotalQuantity" runat="server" />
                            <asp:Label ID="subTotalLabel" runat="server" Text='<%$Resources:OrdersResources, SubtotalWithDiscounts %>' CssClass="sfTxtLbl" />:&nbsp;
                            <strong class="sfPriceTotal"><asp:Label ID="afterDiscountPrice" runat="server" Text="" CssClass="sfTxtLbl" /></strong>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:LinkButton id="updateButton" Text="<%$Resources:OrdersResources, Update %>" runat="server" CssClass="sfshoppingCartUpdateLnk" Visible="false" />
                <%-- Visible False --%>
            </asp:Panel>

            <asp:Panel ID="noProductsInShoppingCartPanel" runat="server" Visible="false" CssClass="sfNoProductsInCartMsg">
                <asp:Literal runat="server" Text='<%$Resources:OrdersResources, NoProductsInShoppingCart %>' Visible="false" />
            </asp:Panel>        
        </asp:PlaceHolder>
    </div>

    I believe the line of code that is relevant here is:

     <asp:Placeholder ID="phBtn" runat="server" Visible="false"><asp:Button ID="checkoutButton" runat="server" Text='Send request' CssClass="sfCheckoutBtn" Visible="false" />

  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    21 Nov 2016
    14 Apr 2014
    Link to this post
    Hello,

    You could use:

    Response.Redirect(url, false);

    or something similar to the one described in the article:

    http://www.w3schools.com/asp/met_redirect.asp


    Using Response.Redirect you will prevent terminating execution of current page. More information could be found on the following article.

    Regards,
    Stefani Tacheva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Nam
    Nam avatar
    4 posts
    Registered:
    31 Mar 2014
    15 Apr 2014 in reply to Stefani Tacheva
    Link to this post

    Can you give me specific direction on how I would use this code for my specific example? I have limited ASP.NET knowledge. Is the example enough information to add the redirect?

3 posts, 0 answered