More in this section

Forums / Developing with Sitefinity / Allow Parameter Validation

Allow Parameter Validation

3 posts, 1 answered
  1. Dev
    Dev avatar
    18 posts
    Registered:
    18 Jan 2013
    24 Jan 2013
    Link to this post
    Hi Everyone,

    Can anyone give me an insight about how "Allow Parameter Validation" mechanism works. Here is my problem, I have the url for a page as domain/about/team, which has list of users. When I click on a user (which is a hyperlink with src as coded name, for example john-appleseed), it is taking me  to this url, domain/about/team/john-appleseed, which is exactly what I wanted. But I want to place a detail view widget on this page, can you guys please help me on how to handle this case. I understand that when the hyperlink is clicked it is posting to the same page with parameter added to its url. But where should I place the detailview widget, where should I write the code to show the detail view if there is a parameter in the url ?
  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    24 Jan 2013 in reply to Dev
    Link to this post

    Hi Prashant,

    I'm not sure what you want. Do you want to use multiple pages to have a List / Detail solution, or do you want to use a Master / Detail view solution for your User list?

    I would go with creating a Dynamic Module for this, which automatically would add Master and Detail view possibilities to your project. In this case it would just work as e.g. the News or Blog module.

    I've done this also for a Dynamic module. Additional I added a custom DetailView on a separate page, because I needed to have more control.

    On the Page_Load event of this UserControl I added this line of code:

    Telerik.Sitefinity.Web.RouteHelper.SetUrlParametersResolved(true);

    And to resolve the parameter I used this code:

    var urlParameterString = System.Web.UI.ControlExtensions.GetUrlParameterString(this, true).Substring(1);
       if (urlParameterString == "undefined")
          return;
     
    // Get the project items
    var dynamicModuleManager = DynamicModuleManager.GetManager();
    var mediaType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Media.MediaFile");
    var media =
                    dynamicModuleManager.GetDataItems(mediaType).FirstOrDefault(x => x.Status == ContentLifecycleStatus.Live && x.UrlName == urlParameterString);

    Maybe this is somewhat helpful for you?

    Regards,
    Daniel

    Answered
  3. Dev
    Dev avatar
    18 posts
    Registered:
    18 Jan 2013
    24 Jan 2013 in reply to Daniel Plomp
    Link to this post
    Thanks for the reply Daniel. Here is what I have got!!!

    I have Dynamic module called "Team" (which was built using module builder
    ). I have added 10 users under that team. I have built an mvc widget which displays name and picture of all the 10 users. I have dragged this widget on to "Team"  page which is under "about" page in the sitefinity. So when I go to domain/about/team, it displays all the 10 users picture with their names under it.  My issue kicks in here, when I click on a user, I want the user details in a page with url "domain/about/team/john-appleseed".  

     I have a widget which takes coded name from parameter and displays all the details about the user. So should I drop this widget on the "Team" page in the sitefinity ? If yes, how can I hide list view and show this widget if there is a parameter in the url ? 

    Is there anything out of the box from sitefinity to do this or should I create a master page in visual studio and override CreateChildControls to hide and show the widgets if there is a parameter in the url?

    May be there is an obvious answer but I don't have huge experience with sitefinity.
      

     
3 posts, 1 answered