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

Forums / General Discussions / Pass form-data from control to different page

Pass form-data from control to different page

2 posts, 0 answered
  1. SolarX
    SolarX avatar
    14 posts
    Registered:
    24 Oct 2006
    14 Oct 2010
    Link to this post
    Hi,

    on our site we have several small search-forms (on different pages) which I want to encapsulate in a usercontrol.
    The result of the search should be displayed in a different page (URL) which contains another usercontrol for search-results.
    I have two questions about this scenario:

    1. What would be the best way to transfer the search-paramters entered in the search-usercontrol to the searchresult-usercontrol (on a different page)? I do not want to pass the information as a querystring, because I have to prevent any automated retrieval of information from our site.

    2. Where could I store the URL of the result-page, so that the search-controls don't have to be configured everytime they are placed on a page. I know that I could store the URL in the web.config... but if the URL of the result-page should change, the web.config would have to be changed manually. Could I use Tags on the result-page so that the search-control could find them in the sitemap. I'm looking for an elegant way here :)

    Thank you for your help.

    Regards
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    14 Oct 2010
    Link to this post
    Hello SolarX,

    Thank you for using our services.

    You have two other options for passing the search parameters to the other page - through SessionState or cookies. The difference between both is that session is stored on the server and cookies on the client. The preferable approach to us is the SessionState.

    When you expose properties for your user controls you can always define default values for those properties or if the property is not set you can set it to a value you want to be default:
    private string resultsPage;
     
    [DefaultValue("~/resultspage.aspx")]
    public string ResultsPage
    {
        get
        {
            return this.resultsPage;
        }
        set
        {
            this.resultsPage = value;
        }
    }


    Or:
    private string resultsPage;
     
    public string ResultsPage
    {
        get
        {
            if(String.IsNullOrEmpty(this.resultsPage))
            {
                this.resultsPage = "~/resultspage.aspx";
            }
            return this.resultsPage;
        }
        set
        {
            this.resultsPage = value;
        }
    }


    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
2 posts, 0 answered