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

Forums / Developing with Sitefinity / how to transfer information between pages with custom user controls?

how to transfer information between pages with custom user controls?

2 posts, 0 answered
  1. Jome Akpoduado
    Jome Akpoduado avatar
    16 posts
    Registered:
    07 Jan 2010
    15 Jan 2010
    Link to this post
    hello,
    I have two pages which I have created with user controls generated from the logic and layout of two pages from an existing application. One page is a data entry form, which on successful completion redirects the user to a results page displaying data entered in the previous page.
    Previously, I have used session objects and variables to store information between the pages and its been working okay.
    However, the same logic will not work in Sitefinity. Is there a way to handle passing information between pages in Sitefinity? Below are snippets of code from the respective pages

                if (newMember.PCFID != null) 
                { 
                    outputString.Append(ddlPCF.SelectedItem.Text + ", "); 
                } 
                outputString.AppendLine(selectedChurch.ToUpper()); 
     
                Session["EntryResults"] = outputString; 
                Session["CallingPageTitle"] = Page.Title; 
                Session["CallingPage"] = Request.Url.AbsolutePath.ToString(); 
                Response.Redirect("results.aspx", true); 
    that is from the originating page
        private void DisplayResults() 
        { 
            string callingPage = (string)Session["CallingPage"]; 
            string pageTitle = (string)Session["CallingPageTitle"]; 
            string filename; 
            if (callingPage != null) 
            { 
                filename = callingPage.Remove(0, callingPage.LastIndexOf("/") + 1); 
                if (filename == "member.aspx") 
                { 
                    StringBuilder showOutput; 
                    showOutput = new StringBuilder(); 
                    showOutput = (StringBuilder)Session["EntryResults"]; 
                    if (showOutput != null) 
                    { 
                        lblResults.Rows = 5
                        lblResults.Text = showOutput.ToString(); 
                        returnLink.NavigateUrl = callingPage
                        returnLink.Text = "Return back to " + (string)Session["CallingPageTitle"]; 
                    } 
                } 
            } 
    I hope this gives clarity what I am trying to achieve.
    When the second page is called, the controls stare blankly at me. :D
    Many thanks for your help
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    20 Jan 2010
    Link to this post
    Hello Jome Akpoduado,

    There are only few places in Sitefinity where we use session. However, there is no problem to use it in Sitefinity. I prepared two user controls that works without problems with session. Both are attached to this tickets and you can give a try to them. SessionControl1 - you have to specify a page of your website where you want to be redirected using a public property. After you click a button called "RedirectTo" you will be redirected to the selected page. On this page you should add SessionControl2. This control will show you the page from where you come from ( the value is set through session) and an option to return back to the same page . All is done with session. You can use a browser tool to check the session ID - whether your session is somehow lost or changed.

    Kind regards,
    Ivan Dimitrov
    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.
2 posts, 0 answered