More in this section

Forums / Developing with Sitefinity / Passing an ID in the URL

Passing an ID in the URL

5 posts, 0 answered
  1. Joseph Smith
    Joseph Smith avatar
    10 posts
    Registered:
    08 Oct 2009
    24 Jun 2010
    Link to this post
    Hi,

    We are using the products module with a ContentView control. Instead of doing the URL rewriting, we would like to pass the ProductID in the URL. Can this be done without custom programming? Can this be done by passing an ID in session instead of the URL? If so, how can this be accomplished?
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 Jun 2010
    Link to this post
    Hello Joseph Smith,

    You can try with something like this:
    <cmsEngine defaultProvider="Generic_Content">
      <providers>
        <clear/>
        ...
          <add name="Products" urlRewriteFormat="/showproduct?ProdID={ID}" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" securityProviderName="" allowVersioning="True" applicationName="/Products" versioningProviderName="" allowComments="false" commentsModeration="true" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data"></add>


    All the best,
    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
  3. Joseph Smith
    Joseph Smith avatar
    10 posts
    Registered:
    08 Oct 2009
    26 Jun 2010
    Link to this post
    Hi,

    Thanks for the advice. Although the link passes an ID, it doesn't appear to be a GUID of a particular product. Here is the URL:

    /1_5_HC_Ranger_250-1_000_Deck_Gun.aspx?ProductID=3773764907

    Can the system pass a URL like this:

    Product.aspx?ProductID=14d01a7a-eca4-4ea4-bee1-b4984e9a0abe

    Here is my provider:

    <add name="Products" urlRewriteFormat="[Name].aspx?ProductID={ID}" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" securityProviderName="" allowVersioning="True" applicationName="/Products" versioningProviderName="" allowComments="false" commentsModeration="true" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data" />
  4. Joseph Smith
    Joseph Smith avatar
    10 posts
    Registered:
    08 Oct 2009
    26 Jun 2010
    Link to this post
    Hi,

    It looks like this was the answer:

    <add name="Products" urlRewriteFormat="/Product.aspx?ProductID={GUID}" urlWhitespaceChar="_" visible="False" defaultMetaField="Name" securityProviderName="" allowVersioning="True" applicationName="/Products" versioningProviderName="" allowComments="false" commentsModeration="true" connectionStringName="GenericContentConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data" />
     
    If I want the ContentView to react to a ProductID in detail mode, how can I do that?
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Jun 2010
    Link to this post
    Hi Joseph Smith,

    What do you mean by "ContentView to react to a ProductID in detail mode" ? The products module is Geenric Content based module. You can set the Provider of ContentView control and the data will be automatically bound. The details mode of the control will resolve the single item by reading its ID from the QueryString as it does for Generic_Content, News, Events, Blogs built-in providers.
    Also, you do not have to append the ID of the content item to the url, because you can get it from IUrlRewriteData as show in this post - How to retrieve News GUID in detail page?
    which is the better option and you will not break the SEO of your website.

    Regards,
    Ivan Dimitrov
    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
Register for webinar
5 posts, 0 answered